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
42.76k stars 9.56k forks source link

go tool vet . fails against Terraform #3466

Closed taliesins closed 9 years ago

taliesins commented 9 years ago

We should run vet tool during the build of Terraform. It should fail if vet fails.

When running vet against Terraform source code

go tool vet .

The following errors encountered: [17:15:59]Step 6/9: Run vet (Command Line) (5s) [17:15:59][Step 6/9] Starting: D:\TeamCity\buildAgent\temp\agentTmp\custom_script6964527631995567932.cmd [17:15:59][Step 6/9] in directory: D:\TeamCity\buildAgent\work\137be3a09cbf86ad [17:15:59][Step 6/9] cd D:\TeamCity\buildAgent\work\137be3a09cbf86ad\src\github.com\mitchellh\terraform [17:15:59][Step 6/9] path=C:\Program Files (x86)\Git\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\Tools\Binn\;c:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\ProgramData\JetBrains\TeamCity\lib\jdbc;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\IIS\Microsoft Web Deploy V3;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;c:\Program Files\Microsoft\Web Platform Installer\;C:\ProgramData\chocolatey\bin;c:\Program Files\nodejs\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseHg\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Red Gate\sqlCI\;C:\Go\bin;D:\TeamCity\buildAgent\work\137be3a09cbf86ad\bin; [17:15:59][Step 6/9] set GOPATH=D:\TeamCity\buildAgent\work\137be3a09cbf86ad [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_instance_migrate.go:23: unreachable code [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_security_group_rule_migrate.go:24: unreachable code [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_vpc_dhcp_options.go:227: unreachable code [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_autoscaling_notification_test.go:147: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_autoscaling_policy_test.go:37: self-assignment of rs to rs [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_instance_test.go:115: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_instance_test.go:120: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_instance_test.go:125: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_instance_test.go:130: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_launch_configuration_test.go:157: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_launch_configuration_test.go:162: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\aws\resource_aws_launch_configuration_test.go:167: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\azure\resource_azure_sql_database_server_test.go:84: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\azure\resource_azure_sql_database_service_test.go:154: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\digitalocean\resource_digitalocean_domain_test.go:47: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\digitalocean\resource_digitalocean_ssh_key_test.go:49: result of fmt.Errorf call not used [17:16:01][Step 6/9] builtin\providers\heroku\resource_heroku_domain.go:46: unresolvable package for heroku.DomainCreateOpts literal [17:16:01][Step 6/9] builtin\providers\heroku\resource_heroku_drain.go:46: unresolvable package for heroku.LogDrainCreateOpts literal [17:16:02][Step 6/9] builtin\providers\openstack\resource_openstack_compute_instance_v2.go:321: github.com/rackspace/gophercloud/openstack/compute/v2/extensions/keypairs.CreateOptsExt composite literal uses unkeyed fields [17:16:02][Step 6/9] builtin\providers\openstack\resource_openstack_compute_instance_v2.go:329: github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume.CreateOptsExt composite literal uses unkeyed fields [17:16:02][Step 6/9] builtin\providers\openstack\resource_openstack_compute_instance_v2.go:339: github.com/rackspace/gophercloud/openstack/compute/v2/extensions/schedulerhints.CreateOptsExt composite literal uses unkeyed fields [17:16:02][Step 6/9] builtin\providers\packet\resource_packet_project_test.go:44: result of fmt.Errorf call not used [17:16:02][Step 6/9] builtin\providers\packet\resource_packet_ssh_key_test.go:47: result of fmt.Errorf call not used [17:16:03][Step 6/9] state\remote\atlas.go:209: unreachable code [17:16:03][Step 6/9] terraform\terraform_test.go:28: unreachable code [17:16:04][Step 6/9] Process exited with code 1 [17:16:04][Step 6/9] Step Run vet (Command Line) failed

stack72 commented 9 years ago

@taliesins when I run make, I see that the following has run:

go generate ./...
TF_ACC= go test ./...  -timeout=30s -parallel=4
go tool vet -asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr .

What make target are you running?

taliesins commented 9 years ago

When I used this:

go tool vet -asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr .

it worked

when I used:

go tool vet .

it failed

Sorry I am still a bit of a golang noob :> I am running this in teamcity on windows.

Golang 1.5.1 with a target of "windows/amd64"

stack72 commented 9 years ago

Nothing to apologise for :)

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.