From 383bbdeebc8426bc58e346e6d22438fcb72ccddd Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 16 Aug 2021 17:19:17 -0700 Subject: [PATCH] Upgrade to Go 1.17 This includes the addition of the new "//go:build" comment form in addition to the legacy "// +build" notation, as produced by gofmt to ensure consistent behavior between Go versions. The new directives are all equivalent to what was present before, so there's no change in behavior. Go 1.17 continues to use the Unicode 13 tables as in Go 1.16, so this upgrade does not require also upgrading our Unicode-related dependencies. This upgrade includes the following breaking changes which will also appear as breaking changes for Terraform users, but that are consistent with the Terraform v1.0 compatibility promises. - On MacOS, Terraform now requires macOS 10.13 High Sierra or later. This upgrade also includes the following breaking changes which will appear as breaking changes for Terraform users that are inconsistent with our compatibility promises, but have justified exceptions as follows: - cidrsubnet, cidrhost, and cidrnetmask will now reject IPv4 CIDR addresses whose decimal components have leading zeros, where previously they would just silently ignore those leading zeros. This is a security-motivated exception to our compatibility promises, because some external systems interpret zero-prefixed octets as octal numbers rather than decimal, and thus the previous lenient parsing could lead to a different interpretation of the address between systems, and thus potentially allow bypassing policy when configuring firewall rules etc. This upgrade also includes the following breaking changes which could _potentially_ appear as breaking changes for Terraform users, but that do not in practice for the reasons given: - The Go net/url package no longer allows query strings with pairs separated by semicolons instead of ampersands. This primarily affects HTTP servers written in Go, and Terraform includes a special temporary HTTP server as part of its implementation of OAuth for "terraform login", but that server only needs to accept URLs created by Terraform itself and Terraform does not generate any URLs that would be rejected. --- .circleci/config.yml | 2 +- .go-version | 2 +- internal/command/cliconfig/config_unix.go | 1 + internal/command/cliconfig/config_windows.go | 1 + internal/command/clistate/local_state_lock_unix.go | 1 + internal/command/clistate/local_state_lock_windows.go | 1 + internal/command/console_interactive.go | 1 + internal/command/console_interactive_solaris.go | 1 + internal/command/testdata/login-oauth-server/main.go | 1 + internal/communicator/ssh/communicator_test.go | 1 + internal/configs/configload/inode.go | 1 + internal/configs/configload/inode_freebsd.go | 1 + internal/configs/configload/inode_windows.go | 1 + internal/helper/wrappedreadline/wrappedreadline_unix.go | 1 + internal/helper/wrappedreadline/wrappedreadline_windows.go | 1 + internal/helper/wrappedstreams/streams_other.go | 1 + internal/helper/wrappedstreams/streams_windows.go | 1 + internal/replacefile/replacefile_unix.go | 1 + internal/replacefile/replacefile_windows.go | 1 + internal/states/statemgr/filesystem_lock_unix.go | 1 + internal/states/statemgr/filesystem_lock_windows.go | 1 + internal/terminal/impl_others.go | 1 + internal/terminal/impl_windows.go | 1 + signal_unix.go | 1 + signal_windows.go | 1 + tools/tools.go | 1 + 26 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d029dc3fb..8ed8d310c6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,7 @@ references: executors: go: docker: - - image: docker.mirror.hashicorp.services/cimg/go:1.16 + - image: docker.mirror.hashicorp.services/cimg/go:1.17 environment: CONSUL_VERSION: 1.7.2 GOMAXPROCS: 4 diff --git a/.go-version b/.go-version index a23207367c..092afa15df 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.16.4 +1.17.0 diff --git a/internal/command/cliconfig/config_unix.go b/internal/command/cliconfig/config_unix.go index f1a9d5936a..6dc1450b23 100644 --- a/internal/command/cliconfig/config_unix.go +++ b/internal/command/cliconfig/config_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package cliconfig diff --git a/internal/command/cliconfig/config_windows.go b/internal/command/cliconfig/config_windows.go index 526b5d1dea..8f232fd5b6 100644 --- a/internal/command/cliconfig/config_windows.go +++ b/internal/command/cliconfig/config_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package cliconfig diff --git a/internal/command/clistate/local_state_lock_unix.go b/internal/command/clistate/local_state_lock_unix.go index 7b2769e374..abf6c5de62 100644 --- a/internal/command/clistate/local_state_lock_unix.go +++ b/internal/command/clistate/local_state_lock_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package clistate diff --git a/internal/command/clistate/local_state_lock_windows.go b/internal/command/clistate/local_state_lock_windows.go index 071aed4944..a51e630773 100644 --- a/internal/command/clistate/local_state_lock_windows.go +++ b/internal/command/clistate/local_state_lock_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package clistate diff --git a/internal/command/console_interactive.go b/internal/command/console_interactive.go index 3ca356a3e4..c9d63245c2 100644 --- a/internal/command/console_interactive.go +++ b/internal/command/console_interactive.go @@ -1,3 +1,4 @@ +//go:build !solaris // +build !solaris // The readline library we use doesn't currently support solaris so diff --git a/internal/command/console_interactive_solaris.go b/internal/command/console_interactive_solaris.go index 576195f143..b6e5d4d73f 100644 --- a/internal/command/console_interactive_solaris.go +++ b/internal/command/console_interactive_solaris.go @@ -1,3 +1,4 @@ +//go:build solaris // +build solaris package command diff --git a/internal/command/testdata/login-oauth-server/main.go b/internal/command/testdata/login-oauth-server/main.go index 4dddec9dbf..105936c4f8 100644 --- a/internal/command/testdata/login-oauth-server/main.go +++ b/internal/command/testdata/login-oauth-server/main.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore // This file is a helper for those doing _manual_ testing of "terraform login" diff --git a/internal/communicator/ssh/communicator_test.go b/internal/communicator/ssh/communicator_test.go index 3880a35606..0ee9015776 100644 --- a/internal/communicator/ssh/communicator_test.go +++ b/internal/communicator/ssh/communicator_test.go @@ -1,3 +1,4 @@ +//go:build !race // +build !race package ssh diff --git a/internal/configs/configload/inode.go b/internal/configs/configload/inode.go index 57df04145a..cbd93204c1 100644 --- a/internal/configs/configload/inode.go +++ b/internal/configs/configload/inode.go @@ -1,3 +1,4 @@ +//go:build linux || darwin || openbsd || netbsd || solaris || dragonfly // +build linux darwin openbsd netbsd solaris dragonfly package configload diff --git a/internal/configs/configload/inode_freebsd.go b/internal/configs/configload/inode_freebsd.go index 4dc28eaa89..cefd72ca55 100644 --- a/internal/configs/configload/inode_freebsd.go +++ b/internal/configs/configload/inode_freebsd.go @@ -1,3 +1,4 @@ +//go:build freebsd // +build freebsd package configload diff --git a/internal/configs/configload/inode_windows.go b/internal/configs/configload/inode_windows.go index 0d22e67264..be26679a84 100644 --- a/internal/configs/configload/inode_windows.go +++ b/internal/configs/configload/inode_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package configload diff --git a/internal/helper/wrappedreadline/wrappedreadline_unix.go b/internal/helper/wrappedreadline/wrappedreadline_unix.go index 00cf29320b..25657f8c3b 100644 --- a/internal/helper/wrappedreadline/wrappedreadline_unix.go +++ b/internal/helper/wrappedreadline/wrappedreadline_unix.go @@ -1,3 +1,4 @@ +//go:build darwin || dragonfly || freebsd || (linux && !appengine) || netbsd || openbsd // +build darwin dragonfly freebsd linux,!appengine netbsd openbsd package wrappedreadline diff --git a/internal/helper/wrappedreadline/wrappedreadline_windows.go b/internal/helper/wrappedreadline/wrappedreadline_windows.go index 110ee5197e..b06a60bf8b 100644 --- a/internal/helper/wrappedreadline/wrappedreadline_windows.go +++ b/internal/helper/wrappedreadline/wrappedreadline_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package wrappedreadline diff --git a/internal/helper/wrappedstreams/streams_other.go b/internal/helper/wrappedstreams/streams_other.go index 82f1e150ca..49dc0157c9 100644 --- a/internal/helper/wrappedstreams/streams_other.go +++ b/internal/helper/wrappedstreams/streams_other.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package wrappedstreams diff --git a/internal/helper/wrappedstreams/streams_windows.go b/internal/helper/wrappedstreams/streams_windows.go index 2709cc0c6f..0508cc8db4 100644 --- a/internal/helper/wrappedstreams/streams_windows.go +++ b/internal/helper/wrappedstreams/streams_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package wrappedstreams diff --git a/internal/replacefile/replacefile_unix.go b/internal/replacefile/replacefile_unix.go index 4bc92b83c9..f0483c006d 100644 --- a/internal/replacefile/replacefile_unix.go +++ b/internal/replacefile/replacefile_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package replacefile diff --git a/internal/replacefile/replacefile_windows.go b/internal/replacefile/replacefile_windows.go index 690e57bc22..e45f35ebd0 100644 --- a/internal/replacefile/replacefile_windows.go +++ b/internal/replacefile/replacefile_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package replacefile diff --git a/internal/states/statemgr/filesystem_lock_unix.go b/internal/states/statemgr/filesystem_lock_unix.go index 1a9709452e..baa991a6d3 100644 --- a/internal/states/statemgr/filesystem_lock_unix.go +++ b/internal/states/statemgr/filesystem_lock_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package statemgr diff --git a/internal/states/statemgr/filesystem_lock_windows.go b/internal/states/statemgr/filesystem_lock_windows.go index 91b4a2a66e..e4f78b6772 100644 --- a/internal/states/statemgr/filesystem_lock_windows.go +++ b/internal/states/statemgr/filesystem_lock_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package statemgr diff --git a/internal/terminal/impl_others.go b/internal/terminal/impl_others.go index fc819aee62..9c0abbc66b 100644 --- a/internal/terminal/impl_others.go +++ b/internal/terminal/impl_others.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package terminal diff --git a/internal/terminal/impl_windows.go b/internal/terminal/impl_windows.go index f6aaa78b9f..46cc6ee3f5 100644 --- a/internal/terminal/impl_windows.go +++ b/internal/terminal/impl_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package terminal diff --git a/signal_unix.go b/signal_unix.go index 573964cfe8..5e742b34ba 100644 --- a/signal_unix.go +++ b/signal_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows package main diff --git a/signal_windows.go b/signal_windows.go index ad1da298ee..d5d2a8a80b 100644 --- a/signal_windows.go +++ b/signal_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows package main diff --git a/tools/tools.go b/tools/tools.go index 8c7097dfd6..1bee9f715c 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package tools