From d749420a25041e18635c050cdadcbfe37275bbc8 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sun, 9 Sep 2018 10:18:08 -0700 Subject: [PATCH 1/4] Fix drift caused from gofmt when running make dev and go 1.11. A fresh checkout of `origin/master` does not build atm using the `dev` target because `master` has not been formatted using `gofmt` from Go 1.11 (tis has been the case for a while if you've been running devel). None of the drift in question is especially new but now that Go 1.11 has been released and gofmt's formatting guidelines have been updated, it would be *really* nice if the code in `master` reflected the current tooling in order to avoid having to fight this drift locally. * 8mo: https://github.com/hashicorp/terraform/blame/master/backend/remote-state/s3/backend_test.go#L260-L261 * 6mo: https://github.com/hashicorp/terraform/blame/master/builtin/provisioners/chef/linux_provisioner_test.go#L124 * 1yr: https://github.com/hashicorp/terraform/blame/7cfeffe36b0be61ca812d33995e184e02a76c0dc/command/init.go#L75-L76 * 12d: https://github.com/hashicorp/terraform/blame/7cfeffe36b0be61ca812d33995e184e02a76c0dc/command/meta_backend_test.go#L1437 * 2yr: https://github.com/hashicorp/terraform/blame/7cfeffe36b0be61ca812d33995e184e02a76c0dc/helper/schema/resource_timeout_test.go#L26 * 4yr: https://github.com/hashicorp/terraform/blame/7cfeffe36b0be61ca812d33995e184e02a76c0dc/helper/schema/schema_test.go#L2059 * 1yr: https://github.com/hashicorp/terraform/blame/7cfeffe36b0be61ca812d33995e184e02a76c0dc/plugin/discovery/get_test.go#L151 --- backend/remote-state/s3/backend_test.go | 4 ++-- builtin/provisioners/chef/linux_provisioner_test.go | 4 ++-- command/init.go | 4 ++-- command/meta_backend_test.go | 2 +- helper/schema/resource_timeout_test.go | 8 ++++---- helper/schema/schema_test.go | 2 +- plugin/discovery/get_test.go | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/backend/remote-state/s3/backend_test.go b/backend/remote-state/s3/backend_test.go index e296cdc42..ae6ca3475 100644 --- a/backend/remote-state/s3/backend_test.go +++ b/backend/remote-state/s3/backend_test.go @@ -257,8 +257,8 @@ func TestBackendPrefixInWorkspace(t *testing.T) { bucketName := fmt.Sprintf("terraform-remote-s3-test-%x", time.Now().Unix()) b := backend.TestBackendConfig(t, New(), map[string]interface{}{ - "bucket": bucketName, - "key": "test-env.tfstate", + "bucket": bucketName, + "key": "test-env.tfstate", "workspace_key_prefix": "env", }).(*Backend) diff --git a/builtin/provisioners/chef/linux_provisioner_test.go b/builtin/provisioners/chef/linux_provisioner_test.go index aa5b93d1d..d6fa7ab8d 100644 --- a/builtin/provisioners/chef/linux_provisioner_test.go +++ b/builtin/provisioners/chef/linux_provisioner_test.go @@ -121,7 +121,7 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) { Commands: map[string]bool{ "curl -LO https://omnitruck.chef.io/install.sh": true, "bash ./install.sh -v \"11.18.6\" -c stable": true, - "rm -f install.sh": true, + "rm -f install.sh": true, }, }, @@ -140,7 +140,7 @@ func TestResourceProvider_linuxInstallChefClient(t *testing.T) { Commands: map[string]bool{ "curl -LO https://omnitruck.chef.io/install.sh": true, "bash ./install.sh -v \"11.18.6\" -c current": true, - "rm -f install.sh": true, + "rm -f install.sh": true, }, }, } diff --git a/command/init.go b/command/init.go index c831566d9..ecc459091 100644 --- a/command/init.go +++ b/command/init.go @@ -72,8 +72,8 @@ func (c *InitCommand) Run(args []string) int { // set providerInstaller if we don't have a test version already if c.providerInstaller == nil { c.providerInstaller = &discovery.ProviderInstaller{ - Dir: c.pluginDir(), - Cache: c.pluginCache(), + Dir: c.pluginDir(), + Cache: c.pluginCache(), PluginProtocolVersion: plugin.Handshake.ProtocolVersion, SkipVerify: !flagVerifyPlugins, Ui: c.Ui, diff --git a/command/meta_backend_test.go b/command/meta_backend_test.go index 701403a05..871ba5ce5 100644 --- a/command/meta_backend_test.go +++ b/command/meta_backend_test.go @@ -1434,7 +1434,7 @@ func TestMetaBackend_configuredChangeCopy_multiToNoDefaultWithDefault(t *testing // Ask input defer testInputMap(t, map[string]string{ "backend-migrate-multistate-to-multistate": "yes", - "new-state-name": "env1", + "new-state-name": "env1", })() // Setup the meta diff --git a/helper/schema/resource_timeout_test.go b/helper/schema/resource_timeout_test.go index ad036600b..bef98071b 100644 --- a/helper/schema/resource_timeout_test.go +++ b/helper/schema/resource_timeout_test.go @@ -23,28 +23,28 @@ func TestResourceTimeout_ConfigDecode_badkey(t *testing.T) { ShouldErr bool }{ { - Name: "Source does not define 'delete' key", + Name: "Source does not define 'delete' key", ResourceDefaultTimeout: timeoutForValues(10, 0, 5, 0, 0), Config: expectedConfigForValues(2, 0, 0, 1, 0), Expected: timeoutForValues(10, 0, 5, 0, 0), ShouldErr: true, }, { - Name: "Config overrides create", + Name: "Config overrides create", ResourceDefaultTimeout: timeoutForValues(10, 0, 5, 0, 0), Config: expectedConfigForValues(2, 0, 7, 0, 0), Expected: timeoutForValues(2, 0, 7, 0, 0), ShouldErr: false, }, { - Name: "Config overrides create, default provided. Should still have zero values", + Name: "Config overrides create, default provided. Should still have zero values", ResourceDefaultTimeout: timeoutForValues(10, 0, 5, 0, 3), Config: expectedConfigForValues(2, 0, 7, 0, 0), Expected: timeoutForValues(2, 0, 7, 0, 3), ShouldErr: false, }, { - Name: "Use something besides 'minutes'", + Name: "Use something besides 'minutes'", ResourceDefaultTimeout: timeoutForValues(10, 0, 5, 0, 3), Config: []map[string]interface{}{ map[string]interface{}{ diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 820352aea..6863482a4 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -2056,7 +2056,7 @@ func TestSchemaMap_Diff(t *testing.T) { State: &terraform.InstanceState{ Attributes: map[string]string{ - "block_device.#": "2", + "block_device.#": "2", "block_device.616397234.delete_on_termination": "true", "block_device.616397234.device_name": "/dev/sda1", "block_device.2801811477.delete_on_termination": "true", diff --git a/plugin/discovery/get_test.go b/plugin/discovery/get_test.go index 65b2497aa..1f123e142 100644 --- a/plugin/discovery/get_test.go +++ b/plugin/discovery/get_test.go @@ -148,7 +148,7 @@ func TestProviderInstallerGet(t *testing.T) { // attempt to use an incompatible protocol version i := &ProviderInstaller{ - Dir: tmpDir, + Dir: tmpDir, PluginProtocolVersion: 5, SkipVerify: true, Ui: cli.NewMockUi(), @@ -159,7 +159,7 @@ func TestProviderInstallerGet(t *testing.T) { } i = &ProviderInstaller{ - Dir: tmpDir, + Dir: tmpDir, PluginProtocolVersion: 3, SkipVerify: true, Ui: cli.NewMockUi(), @@ -231,7 +231,7 @@ func TestProviderInstallerPurgeUnused(t *testing.T) { f.Close() i := &ProviderInstaller{ - Dir: tmpDir, + Dir: tmpDir, PluginProtocolVersion: 3, SkipVerify: true, Ui: cli.NewMockUi(), From 561e973b4e43164050c7f792c91079f857149f59 Mon Sep 17 00:00:00 2001 From: Sean Chittenden Date: Sun, 9 Sep 2018 10:39:36 -0700 Subject: [PATCH 2/4] Bump travis to 1.11 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3828981b4..d61dee344 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ services: - docker language: go go: -- "1.10.1" +- "1.11" # add TF_CONSUL_TEST=1 to run consul tests # they were causing timouts in travis From d08cead067823fd9a2e9142007513ce4f2178abf Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Fri, 14 Sep 2018 10:51:04 -0700 Subject: [PATCH 3/4] upgrading github.com/xanzy/ssh-agent for go 1.11 compatibility --- .../xanzy/ssh-agent/pageant_windows.go | 28 +++++++++---------- vendor/vendor.json | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go b/vendor/github.com/xanzy/ssh-agent/pageant_windows.go index 3507b0228..629560796 100644 --- a/vendor/github.com/xanzy/ssh-agent/pageant_windows.go +++ b/vendor/github.com/xanzy/ssh-agent/pageant_windows.go @@ -29,8 +29,8 @@ import ( "errors" "fmt" "sync" - . "syscall" - . "unsafe" + "syscall" + "unsafe" ) // Maximum size of message can be sent to pageant @@ -53,7 +53,7 @@ const ( type copyData struct { dwData uintptr cbData uint32 - lpData Pointer + lpData unsafe.Pointer } var ( @@ -65,7 +65,7 @@ var ( ) func winAPI(dllName, funcName string) func(...uintptr) (uintptr, uintptr, error) { - proc := MustLoadDLL(dllName).MustFindProc(funcName) + proc := syscall.MustLoadDLL(dllName).MustFindProc(funcName) return func(a ...uintptr) (uintptr, uintptr, error) { return proc.Call(a...) } } @@ -96,21 +96,21 @@ func query(msg []byte) ([]byte, error) { thID, _, _ := winGetCurrentThreadID() mapName := fmt.Sprintf("PageantRequest%08x", thID) - pMapName, _ := UTF16PtrFromString(mapName) + pMapName, _ := syscall.UTF16PtrFromString(mapName) - mmap, err := CreateFileMapping(InvalidHandle, nil, PAGE_READWRITE, 0, MaxMessageLen+4, pMapName) + mmap, err := syscall.CreateFileMapping(syscall.InvalidHandle, nil, syscall.PAGE_READWRITE, 0, MaxMessageLen+4, pMapName) if err != nil { return nil, err } - defer CloseHandle(mmap) + defer syscall.CloseHandle(mmap) - ptr, err := MapViewOfFile(mmap, FILE_MAP_WRITE, 0, 0, 0) + ptr, err := syscall.MapViewOfFile(mmap, syscall.FILE_MAP_WRITE, 0, 0, 0) if err != nil { return nil, err } - defer UnmapViewOfFile(ptr) + defer syscall.UnmapViewOfFile(ptr) - mmSlice := (*(*[MaxMessageLen]byte)(Pointer(ptr)))[:] + mmSlice := (*(*[MaxMessageLen]byte)(unsafe.Pointer(ptr)))[:] copy(mmSlice, msg) @@ -119,10 +119,10 @@ func query(msg []byte) ([]byte, error) { cds := copyData{ dwData: agentCopydataID, cbData: uint32(len(mapNameBytesZ)), - lpData: Pointer(&(mapNameBytesZ[0])), + lpData: unsafe.Pointer(&(mapNameBytesZ[0])), } - resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(Pointer(&cds))) + resp, _, _ := winSendMessage(paWin, wmCopydata, 0, uintptr(unsafe.Pointer(&cds))) if resp == 0 { return nil, ErrSendMessage @@ -140,7 +140,7 @@ func query(msg []byte) ([]byte, error) { } func pageantWindow() uintptr { - nameP, _ := UTF16PtrFromString("Pageant") - h, _, _ := winFindWindow(uintptr(Pointer(nameP)), uintptr(Pointer(nameP))) + nameP, _ := syscall.UTF16PtrFromString("Pageant") + h, _, _ := winFindWindow(uintptr(unsafe.Pointer(nameP)), uintptr(unsafe.Pointer(nameP))) return h } diff --git a/vendor/vendor.json b/vendor/vendor.json index 40d3646b7..196908d41 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -2408,10 +2408,10 @@ "revisionTime": "2017-06-05T21:53:11Z" }, { - "checksumSHA1": "iHiMTBffQvWYlOLu3130JXuQpgQ=", + "checksumSHA1": "VNhImVFfxO7x8Kp1BrM2zgp4vi0=", "path": "github.com/xanzy/ssh-agent", - "revision": "ba9c9e33906f58169366275e3450db66139a31a9", - "revisionTime": "2015-12-15T15:34:51Z" + "revision": "640f0ab560aeb89d523bb6ac322b1244d5c3796c", + "revisionTime": "2018-07-03T18:17:07Z" }, { "checksumSHA1": "xtw+Llokq30p1Gn+Q8JBZ7NtE+I=", From 1df423e302ca2d93337621e2340c855a24c4c9e8 Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Mon, 17 Sep 2018 08:57:34 -0700 Subject: [PATCH 4/4] update README.md with current required go version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b3b056ae3..c88a061ec 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ All documentation is available on the [Terraform website](http://www.terraform.i Developing Terraform -------------------- -If you wish to work on Terraform itself or any of its built-in providers, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.10+ is *required*). Alternatively, you can use the Vagrantfile in the root of this repo to stand up a virtual machine with the appropriate dev tooling already set up for you. +If you wish to work on Terraform itself or any of its built-in providers, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.11+ is *required*). Alternatively, you can use the Vagrantfile in the root of this repo to stand up a virtual machine with the appropriate dev tooling already set up for you. This repository contains only Terraform core, which includes the command line interface and the main graph engine. Providers are implemented as plugins that each have their own repository in [the `terraform-providers` organization](https://github.com/terraform-providers) on GitHub. Instructions for developing each provider are in the associated README file. For more information, see [the provider development overview](https://www.terraform.io/docs/plugins/provider.html).