Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to Terraform 0.12.6 #375

Merged
merged 1 commit into from
Aug 2, 2019

Conversation

lawliet89
Copy link
Contributor

@lawliet89 lawliet89 commented Aug 2, 2019

Fixes #374

I had to edit the generated tflint/loader_mock.go because it was creating a circular dependency.

@wata727
Copy link
Member

wata727 commented Aug 2, 2019

I had to edit the generated tflint/loader_mock.go because it was creating a circular dependency.

Does that circular dependency fail the test?
In my environment, it seems that I can pass the test without any changes.

$ GO111MODULE=on make code
go mod vendor
go generate ./...
$ GO111MODULE=on make test
go mod vendor                                                                                                   
go test $(go list ./... | grep -v vendor | grep -v aws-sdk-go)                                                  
ok      github.com/wata727/tflint       0.117s                                                                  
ok      github.com/wata727/tflint/client        0.014s                                                          
ok      github.com/wata727/tflint/cmd   0.078s
ok      github.com/wata727/tflint/issue 0.027s [no tests to run]
ok      github.com/wata727/tflint/printer       0.036s
?       github.com/wata727/tflint/project       [no test files]
ok      github.com/wata727/tflint/rules 0.033s
ok      github.com/wata727/tflint/rules/awsrules        0.100s
ok      github.com/wata727/tflint/rules/awsrules/models 0.118s
ok      github.com/wata727/tflint/rules/terraformrules  0.015s
ok      github.com/wata727/tflint/tflint        0.098s

@lawliet89
Copy link
Contributor Author

lawliet89 commented Aug 2, 2019

If I run make code again, it creates the diff

diff --git a/tflint/loader_mock.go b/tflint/loader_mock.go
index f479e4c..a8796a5 100644
--- a/tflint/loader_mock.go
+++ b/tflint/loader_mock.go
@@ -8,6 +8,7 @@ import (
        gomock "github.com/golang/mock/gomock"
        configs "github.com/hashicorp/terraform/configs"
        terraform "github.com/hashicorp/terraform/terraform"
+       tflint "github.com/wata727/tflint/tflint"
        reflect "reflect"
 )
 
@@ -50,10 +51,10 @@ func (mr *MockAbstractLoaderMockRecorder) LoadConfig(arg0 interface{}) *gomock.C
 }
 
 // LoadAnnotations mocks base method
-func (m *MockAbstractLoader) LoadAnnotations(arg0 string) (map[string]Annotations, error) {
+func (m *MockAbstractLoader) LoadAnnotations(arg0 string) (map[string]tflint.Annotations, error) {
        m.ctrl.T.Helper()
        ret := m.ctrl.Call(m, "LoadAnnotations", arg0)
-       ret0, _ := ret[0].(map[string]Annotations)
+       ret0, _ := ret[0].(map[string]tflint.Annotations)
        ret1, _ := ret[1].(error)
        return ret0, ret1
 }

and it fails to build:

$ make 
go mod vendor
go test $(go list ./... | grep -v vendor | grep -v aws-sdk-go)
can't load package: import cycle not allowed
package github.com/wata727/tflint
	imports github.com/wata727/tflint/cmd
	imports github.com/wata727/tflint/rules
	imports github.com/wata727/tflint/rules/awsrules
	imports github.com/wata727/tflint/tflint
	imports github.com/wata727/tflint/tflint
import cycle not allowed
package github.com/wata727/tflint
	imports github.com/wata727/tflint/cmd
	imports github.com/wata727/tflint/rules
	imports github.com/wata727/tflint/rules/awsrules
	imports github.com/wata727/tflint/tflint
	imports github.com/wata727/tflint/tflint
make: *** [Makefile:7: test] Error 1

I just installed Mockgen. So it's at commit dd8d2a22370e4c8a334e80ca8477f71356c8e4bb.

@wata727
Copy link
Member

wata727 commented Aug 2, 2019

That's strange. There may be a problem with the versions of mockgen and Go. Can you update the mockgen to the latest?

My environment:

$ go version
go version go1.12 linux/amd64
$ cd $GOPATH/src/github.com/golang/mock
$ git rev-parse HEAD
6e20fef50e74e443696bc32b693cf286b612d45b

@lawliet89
Copy link
Contributor Author

lawliet89 commented Aug 2, 2019

~/go/src/github.com/golang/mock (master=)$ go version
go version go1.12.5 linux/amd64
~/go/src/github.com/golang/mock (master=)$ git rev-parse HEAD
dd8d2a22370e4c8a334e80ca8477f71356c8e4bb
~/go/src/github.com/golang/mock (master=)$ git pull
Already up to date.

This is the latest.

This might be because I don't have tflint checked out in $GOPATH.

@wata727
Copy link
Member

wata727 commented Aug 2, 2019

Ah, ok. My gomock seems to be old.
By the way, there is still no diff when running make code, how is that?

$GO111MODULE=on make code
go mod vendor
go generate ./...
$ git diff
(no stdout)
$ git rev-parse HEAD
dd8d2a22370e4c8a334e80ca8477f71356c8e4bb

@lawliet89
Copy link
Contributor Author

lawliet89 commented Aug 2, 2019

I found out why. If I check out tflint inside $GOPATH and I run GO111MODULE=on make code, then there is no diff and it works fine.

It was because I had tflint in another directory.

Anyway I think this should not affect the PR.

Copy link
Member

@wata727 wata727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'll release it tonight.

@wata727 wata727 merged commit f2b1a93 into terraform-linters:master Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

tflint 0.9.2 issue with terraform 0.12.6, for_each
2 participants