hashicorp / terraform

Terraform enables you to safely and predictably create, change, and improve infrastructure. It is a source-available tool that codifies APIs into declarative configuration files that can be shared amongst team members, treated as code, edited, reviewed, and versioned.
https://www.terraform.io/
Other
41.76k stars 9.42k forks source link

Local build failure starting before v0.10.8 #16701

Closed nbering closed 6 years ago

nbering commented 6 years ago

I've been building Terraform locally for some time, and I've never had an issue building from a tagged version until v0.10.8. It doesn't seem to be the build itself, but rather some preconditions in the makefile. I ran git bisect to isolate the commits that the two separate errors I'm getting originated in.

I know Terraform fairly well, but I'm not a very experienced go developer, so I wasn't able to do much more than identify that the issues started in dadec5210be3e53c3808207ba31f158cb85e984e and 61cd3bf02a69a8bfbfc6aff843dcea4779a63628.

The packages mentioned in the build errors below are definitely present in the vendor folder, so I'm a little at a loss as to where to begin. Running scripts/build.sh runs without errors.

@apparentlymart Both problem commits originate with you. Any insight or suggestions?

Terraform Version

Beginning at dadec5210be3e53c3808207ba31f158cb85e984e

Terraform Configuration Files

N/A

Expected Behavior

Project should build locally.

Actual Behavior

Starting in dadec5210be3e53c3808207ba31f158cb85e984e...

$ make
==> Checking that code complies with gofmt requirements...
go generate ./...
2017/11/18 21:21:43 Generated command/internal_plugin_list.go
stringer: checking package: decoder_spec.go:4:2: could not import github.com/hashicorp/hcl2/hcldec (can't find import: github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl2/hcldec)
config/configschema/schema.go:60: running "stringer": exit status 1
make: *** [generate] Error 1

Starting in 61cd3bf02a69a8bfbfc6aff843dcea4779a63628...

$ make
==> Checking that code complies with gofmt requirements...
go generate ./...
2017/11/18 21:29:55 Generated command/internal_plugin_list.go
stringer: checking package: decoder_spec.go:4:2: could not import github.com/hashicorp/hcl2/hcldec (can't find import: github.com/hashicorp/terraform/vendor/github.com/hashicorp/hcl2/hcldec)
config/configschema/schema.go:80: running "stringer": exit status 1
stringer: checking package: diagnostics.go:7:2: could not import github.com/hashicorp/errwrap (reading export data: /Users/nicholasbering/work/pkg/darwin_amd64/github.com/hashicorp/terraform/vendor/github.com/hashicorp/errwrap.a: invalid encoding format in export data: got 'v'; want 'c' or 'd')
tfdiags/diagnostic.go:11: running "stringer": exit status 1
make: *** [generate] Error 1

Important Factoids

$ go version
go version go1.9.2 darwin/amd64
$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G29
nbering commented 6 years ago

Seems this is duplicate of #16686. Hadn't read through all the recent issues to catch this before posting. I'm going to leave this open for the moment... as my description contains the commits found with bisect. Looking into this "stringer" tool now.

nbering commented 6 years ago

Solved for myself. Solution was to update the stringer utility. Simple one-command fix:

$ go get -u -a golang.org/x/tools/cmd/stringer
paulrigor commented 6 years ago

Hey folks. My apologies in advance if this is not the correct thread (or if it's a duplicate thread).

So I updated stringer, but make throws the following error

==> Checking that code complies with gofmt requirements... ./src/golang.org/x/tools/cmd/fiximports/testdata/src/old.com/bad/bad.go:2:43: expected 'package', found 'EOF' ./src/golang.org/x/tools/go/loader/testdata/badpkgdecl.go:1:34: expected 'package', found 'EOF' gofmt needs running on the following files: ./command/internal_plugin_list.go ./src/golang.org/x/tools/go/ssa/testdata/valueforexpr.go You can use the command:make fmtto reformat code. make: *** [fmtcheck] Error 1

nbering commented 6 years ago

Hi @paulrigor,

That appears to be distinctly different from what was solved here. Your output doesn't appear to have anything to do with the 'stringer' utility.

If I had to guess from the error messages, it would appear to me from your error messages that some package in your build has an invalid go file. Beyond that, I'd be completely guessing.

ghost commented 4 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.