Skip to content

Commit

Permalink
Add gofmt -s to CI (hashicorp#146)
Browse files Browse the repository at this point in the history
* Add gofmt to CI

* Apply gofmt -s

* Add check job to CI

* Install go-fmt-fail

* Revert "Add check job to CI"

This reverts commit f923bc2.

* Fix Makefile fmt command

* Add .gitattributes
  • Loading branch information
jojo43 authored Jun 29, 2020
1 parent e40f7c5 commit c3bdf23
Show file tree
Hide file tree
Showing 21 changed files with 469 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.go text eol=lf
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
-
name: Go mod verify
run: go mod verify
-
name: Run go fmt
run: make fmt
-
name: Run tests
run: make test
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export GOFLAGS = -mod=vendor

default: test

fmt:
go run github.com/mh-cbon/go-fmt-fail ./...

test:
go test -mod=vendor -v -cover ./...
go test -v -cover ./...

.PHONY: test
.PHONY: fmt test
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/hashicorp/go-version v1.2.0
github.com/hashicorp/hcl/v2 v2.5.2-0.20200528183353-fa7c453538de
github.com/hashicorp/terraform-json v0.5.0
github.com/mh-cbon/go-fmt-fail v0.0.0-20160815164508-67765b3fbcb5
github.com/mitchellh/cli v1.0.0
github.com/pmezard/go-difflib v1.0.0
github.com/sourcegraph/go-lsp v0.0.0-20200117082640-b19bb38222e2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRU
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mh-cbon/go-fmt-fail v0.0.0-20160815164508-67765b3fbcb5 h1:shw+DWUaHIyW64Tv30ASCbC6QO6fLy+M5SJb5pJVEI4=
github.com/mh-cbon/go-fmt-fail v0.0.0-20160815164508-67765b3fbcb5/go.mod h1:nHPoxaBUc5CDAMIv0MNmn5PBjWbTs9BI/eh30/n0U6g=
github.com/mitchellh/cli v1.0.0 h1:iGBIsUe3+HZ/AD/Vd7DErOt5sU9fa8Uj7A2s1aggv1Y=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
Expand Down
6 changes: 3 additions & 3 deletions internal/terraform/lang/config_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func TestCompletableLabels_CompletionCandidatesAtPos_overLimit(t *testing.T) {
},
tBlock: tBlock,
labels: map[string][]*labelCandidate{
"type": []*labelCandidate{
"type": {
{label: "aaa"},
{label: "bbb"},
{label: "ccc"},
Expand Down Expand Up @@ -338,7 +338,7 @@ func TestCompletableLabels_CompletionCandidatesAtPos_matchingLimit(t *testing.T)
},
tBlock: tBlock,
labels: map[string][]*labelCandidate{
"type": []*labelCandidate{
"type": {
{label: "aaa"},
{label: "bbb"},
},
Expand Down Expand Up @@ -374,7 +374,7 @@ func TestCompletableLabels_CompletionCandidatesAtPos_withPrefix(t *testing.T) {
},
tBlock: tBlock,
labels: map[string][]*labelCandidate{
"type": []*labelCandidate{
"type": {
{label: "prov_aaa"},
{label: "prov_bbb"},
{label: "ccc"},
Expand Down
5 changes: 5 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// +build tools

package main

import _ "github.com/mh-cbon/go-fmt-fail"
3 changes: 3 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/.version

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

75 changes: 75 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions vendor/github.com/mh-cbon/go-fmt-fail/appveyor.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c3bdf23

Please sign in to comment.