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 4d029dc3f..8ed8d310c 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 a23207367..092afa15d 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 f1a9d5936..6dc1450b2 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 526b5d1de..8f232fd5b 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 7b2769e37..abf6c5de6 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 071aed494..a51e63077 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 3ca356a3e..c9d63245c 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 576195f14..b6e5d4d73 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 4dddec9db..105936c4f 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 3880a3560..0ee901577 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 57df04145..cbd93204c 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 4dc28eaa8..cefd72ca5 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 0d22e6726..be26679a8 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 00cf29320..25657f8c3 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 110ee5197..b06a60bf8 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 82f1e150c..49dc0157c 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 2709cc0c6..0508cc8db 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 4bc92b83c..f0483c006 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 690e57bc2..e45f35ebd 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 1a9709452..baa991a6d 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 91b4a2a66..e4f78b677 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 fc819aee6..9c0abbc66 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 f6aaa78b9..46cc6ee3f 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 573964cfe..5e742b34b 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 ad1da298e..d5d2a8a80 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 8c7097dfd..1bee9f715 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -1,3 +1,4 @@ +//go:build tools // +build tools package tools