diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 5e49217794..76d2fa53f6 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -175,7 +175,7 @@ jobs: - name: "Copyright headers" run: | - go run github.com/hashicorp/copywrite headers --plan + go tool github.com/hashicorp/copywrite headers --plan if [[ $? != 0 ]]; then echo >&2 "ERROR: some files are missing required copyright headers. Run `scripts/add-copyright-headers.sh` locally and then commit the updated files." exit 1 diff --git a/go.mod b/go.mod index 58c9c981bb..8646afa2c5 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/opentofu/opentofu +go 1.25.2 + // At the time of adding this configuration, the new Go feature introduced here https://github.com/golang/go/issues/67061, // was having a good amount of issues linked to, affecting AWS Firewall, GCP various services and a lot more. // In go1.23 the godebug flag for this was named 'tlskyber', renamed in go1.24 to 'tlsmlkem'. https://tip.golang.org/doc/godebug#go-124 @@ -44,7 +46,6 @@ require ( github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.65 github.com/hashicorp/consul/api v1.13.0 github.com/hashicorp/consul/sdk v0.8.0 - github.com/hashicorp/copywrite v0.16.3 github.com/hashicorp/errwrap v1.1.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-getter v1.8.2 @@ -70,9 +71,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-linereader v0.0.0-20190213213312-1b945b3263eb github.com/mitchellh/go-wordwrap v1.0.1 - github.com/mitchellh/gox v1.0.1 github.com/mitchellh/reflectwalk v1.0.2 - github.com/nishanths/exhaustive v0.7.11 github.com/openbao/openbao/api/v2 v2.3.0 github.com/opencontainers/go-digest v1.0.0 github.com/opencontainers/image-spec v1.1.1 @@ -105,12 +104,9 @@ require ( golang.org/x/sys v0.37.0 golang.org/x/term v0.36.0 golang.org/x/text v0.28.0 - golang.org/x/tools v0.35.0 google.golang.org/api v0.155.0 google.golang.org/grpc v1.76.0 - google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.36.10 - honnef.co/go/tools v0.4.2 k8s.io/api v0.23.4 k8s.io/apimachinery v0.23.4 k8s.io/client-go v0.23.4 @@ -118,35 +114,26 @@ require ( oras.land/oras-go/v2 v2.6.0 ) -require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect - github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect - github.com/Azure/go-autorest/autorest v0.11.24 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - github.com/rogpeppe/go-internal v1.14.1 // indirect - github.com/stretchr/objx v0.5.2 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect -) - require ( cloud.google.com/go v0.112.0 // indirect cloud.google.com/go/compute/metadata v0.7.0 // indirect cloud.google.com/go/iam v1.1.5 // indirect github.com/AlecAivazis/survey/v2 v2.3.6 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.10.1 + github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.8.0 github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azkeys v1.4.0 + github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.2.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.1 github.com/Azure/go-autorest v14.2.0+incompatible // indirect + github.com/Azure/go-autorest/autorest v0.11.24 // indirect github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect + github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/BurntSushi/toml v1.2.1 // indirect github.com/ChrisTrenkamp/goxpath v0.0.0-20190607011252-c5096ec8773d // indirect github.com/Masterminds/goutils v1.1.1 // indirect @@ -196,6 +183,7 @@ require ( github.com/gofrs/uuid v4.0.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect + github.com/golang-jwt/jwt/v5 v5.2.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/go-github/v45 v45.2.0 // indirect @@ -205,6 +193,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gnostic v0.5.5 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect + github.com/hashicorp/copywrite v0.16.3 // indirect github.com/hashicorp/go-immutable-radix v1.0.0 // indirect github.com/hashicorp/go-msgpack v0.5.4 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect @@ -227,6 +216,7 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.15.11 // indirect github.com/knadh/koanf v1.5.0 // indirect + github.com/kylelemons/godebug v1.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/masterzen/simplexml v0.0.0-20190410153822-31eea3082786 // indirect github.com/mattn/go-colorable v0.1.14 // indirect @@ -234,6 +224,7 @@ require ( github.com/mergestat/timediff v0.0.3 // indirect github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect + github.com/mitchellh/gox v1.0.1 // indirect github.com/mitchellh/iochan v1.0.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -243,13 +234,16 @@ require ( github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect github.com/oklog/run v1.1.0 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/rivo/uniseg v0.2.0 // indirect + github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/samber/lo v1.37.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cobra v1.6.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/stretchr/objx v0.5.2 // indirect github.com/thanhpk/randstr v1.0.4 // indirect github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect github.com/ulikunitz/xz v0.5.15 // indirect @@ -265,16 +259,20 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.21.0 // indirect go.opentelemetry.io/otel/metric v1.38.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a // indirect golang.org/x/time v0.11.0 // indirect + golang.org/x/tools v0.35.0 // indirect golang.org/x/tools/go/expect v0.1.1-deprecated // indirect google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect + google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/tools v0.4.2 // indirect k8s.io/klog/v2 v2.30.0 // indirect k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect @@ -282,6 +280,14 @@ require ( sigs.k8s.io/yaml v1.2.0 // indirect ) -go 1.25.2 - replace github.com/hashicorp/hcl/v2 v2.20.1 => github.com/opentofu/hcl/v2 v2.20.2-0.20250121132637-504036cd70e7 + +tool ( + github.com/hashicorp/copywrite + github.com/mitchellh/gox + go.uber.org/mock/mockgen + golang.org/x/tools/cmd/stringer + google.golang.org/grpc/cmd/protoc-gen-go-grpc + google.golang.org/protobuf/cmd/protoc-gen-go + honnef.co/go/tools/cmd/staticcheck +) diff --git a/go.sum b/go.sum index 9b29c6c4d5..0d00144ede 100644 --- a/go.sum +++ b/go.sum @@ -726,8 +726,6 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nishanths/exhaustive v0.7.11 h1:xV/WU3Vdwh5BUH4N06JNUznb6d5zhRPOnlgCrpNYNKA= -github.com/nishanths/exhaustive v0.7.11/go.mod h1:gX+MP7DWMKJmNa1HfMozK+u04hQd3na9i0hyqf3/dOI= github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= @@ -890,7 +888,6 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.17.0 h1:seZvECve6XX4tmnvRzWtJNHdscMtYEx5R7bnnVyd/d0= github.com/zclconf/go-cty v1.17.0/go.mod h1:wqFzcImaLTI6A5HfsRwB0nj5n0MRZFwmey8YoFPPs3U= @@ -1058,7 +1055,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -1166,7 +1162,6 @@ golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1274,7 +1269,6 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= diff --git a/internal/addrs/check_rule.go b/internal/addrs/check_rule.go index 41d1ecce99..ec1abbbb2b 100644 --- a/internal/addrs/check_rule.go +++ b/internal/addrs/check_rule.go @@ -84,7 +84,7 @@ func (k checkRuleKey) uniqueKeySigil() {} // itself.) type CheckRuleType int -//go:generate go run golang.org/x/tools/cmd/stringer -type=CheckRuleType check_rule.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=CheckRuleType check_rule.go const ( InvalidCondition CheckRuleType = 0 diff --git a/internal/addrs/checkable.go b/internal/addrs/checkable.go index ab18c845be..50b9b5465f 100644 --- a/internal/addrs/checkable.go +++ b/internal/addrs/checkable.go @@ -51,7 +51,7 @@ var ( // CheckableKind describes the different kinds of checkable objects. type CheckableKind rune -//go:generate go run golang.org/x/tools/cmd/stringer -type=CheckableKind checkable.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=CheckableKind checkable.go const ( CheckableKindInvalid CheckableKind = 0 diff --git a/internal/addrs/move_endpoint_kind.go b/internal/addrs/move_endpoint_kind.go index e29acfc7f5..03b3761ede 100644 --- a/internal/addrs/move_endpoint_kind.go +++ b/internal/addrs/move_endpoint_kind.go @@ -11,7 +11,7 @@ import "fmt" // address can refer to. type MoveEndpointKind rune -//go:generate go run golang.org/x/tools/cmd/stringer -type MoveEndpointKind +//go:generate go tool golang.org/x/tools/cmd/stringer -type MoveEndpointKind const ( // MoveEndpointModule indicates that a move endpoint either refers to diff --git a/internal/addrs/resource.go b/internal/addrs/resource.go index 2ca7fe117e..f5f4dee490 100644 --- a/internal/addrs/resource.go +++ b/internal/addrs/resource.go @@ -499,7 +499,7 @@ func (k configResourceKey) uniqueKeySigil() {} // resource lifecycle has a slightly different address format. type ResourceMode rune -//go:generate go run golang.org/x/tools/cmd/stringer -type ResourceMode +//go:generate go tool golang.org/x/tools/cmd/stringer -type ResourceMode const ( // InvalidResourceMode is the zero value of ResourceMode and is not diff --git a/internal/backend/operation_type.go b/internal/backend/operation_type.go index 61e398efb3..1853b82673 100644 --- a/internal/backend/operation_type.go +++ b/internal/backend/operation_type.go @@ -5,7 +5,7 @@ package backend -//go:generate go run golang.org/x/tools/cmd/stringer -type=OperationType operation_type.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=OperationType operation_type.go // OperationType is an enum used with Operation to specify the operation // type to perform for OpenTofu. diff --git a/internal/backend/remote-state/http/server_test.go b/internal/backend/remote-state/http/server_test.go index 88143300d3..caba8a0e2c 100644 --- a/internal/backend/remote-state/http/server_test.go +++ b/internal/backend/remote-state/http/server_test.go @@ -5,7 +5,7 @@ package http -//go:generate go run go.uber.org/mock/mockgen -package $GOPACKAGE -source $GOFILE -destination mock_$GOFILE +//go:generate go tool go.uber.org/mock/mockgen -package $GOPACKAGE -source $GOFILE -destination mock_$GOFILE import ( "context" diff --git a/internal/checks/status.go b/internal/checks/status.go index ee5a008bfe..dc2a27ddb1 100644 --- a/internal/checks/status.go +++ b/internal/checks/status.go @@ -15,7 +15,7 @@ import ( // checkable object. type Status rune -//go:generate go run golang.org/x/tools/cmd/stringer -type=Status +//go:generate go tool golang.org/x/tools/cmd/stringer -type=Status const ( // StatusUnknown represents that there is not yet a conclusive result diff --git a/internal/cloud/migration.go b/internal/cloud/migration.go index f7b0805665..81bf9771ad 100644 --- a/internal/cloud/migration.go +++ b/internal/cloud/migration.go @@ -19,7 +19,7 @@ import ( // the context of Cloud integration mode. type ConfigChangeMode rune -//go:generate go run golang.org/x/tools/cmd/stringer -type ConfigChangeMode +//go:generate go tool golang.org/x/tools/cmd/stringer -type ConfigChangeMode const ( // ConfigMigrationIn represents when the configuration calls for using diff --git a/internal/command/arguments/show.go b/internal/command/arguments/show.go index 214b3aaec6..5b50ed31ec 100644 --- a/internal/command/arguments/show.go +++ b/internal/command/arguments/show.go @@ -32,7 +32,7 @@ type Show struct { // shown by the "tofu show" command. type ShowTargetType int -//go:generate go run golang.org/x/tools/cmd/stringer -type=ShowTargetType +//go:generate go tool golang.org/x/tools/cmd/stringer -type=ShowTargetType const ( // ShowUnknownType is the zero value of [ShowTargetType], and represents // that the target type is ambiguous and so must be inferred by the diff --git a/internal/configs/configschema/schema.go b/internal/configs/configschema/schema.go index 85f475d795..6ce418bcae 100644 --- a/internal/configs/configschema/schema.go +++ b/internal/configs/configschema/schema.go @@ -146,7 +146,7 @@ type NestingMode int // Object represents the embedding of a NestedBl -//go:generate go run golang.org/x/tools/cmd/stringer -type=NestingMode +//go:generate go tool golang.org/x/tools/cmd/stringer -type=NestingMode const ( nestingModeInvalid NestingMode = iota diff --git a/internal/configs/provisioner.go b/internal/configs/provisioner.go index 787d7a0d59..f3fdaeacf9 100644 --- a/internal/configs/provisioner.go +++ b/internal/configs/provisioner.go @@ -208,7 +208,7 @@ type Connection struct { // ProvisionerWhen is an enum for valid values for when to run provisioners. type ProvisionerWhen int -//go:generate go run golang.org/x/tools/cmd/stringer -type ProvisionerWhen +//go:generate go tool golang.org/x/tools/cmd/stringer -type ProvisionerWhen const ( ProvisionerWhenInvalid ProvisionerWhen = iota @@ -220,7 +220,7 @@ const ( // for provisioners. type ProvisionerOnFailure int -//go:generate go run golang.org/x/tools/cmd/stringer -type ProvisionerOnFailure +//go:generate go tool golang.org/x/tools/cmd/stringer -type ProvisionerOnFailure const ( ProvisionerOnFailureInvalid ProvisionerOnFailure = iota diff --git a/internal/configs/variable_type_hint.go b/internal/configs/variable_type_hint.go index 7c868249ff..55d6de0e29 100644 --- a/internal/configs/variable_type_hint.go +++ b/internal/configs/variable_type_hint.go @@ -24,7 +24,7 @@ package configs // - TypeHintMap requires a type that could be converted to an object type VariableTypeHint rune -//go:generate go run golang.org/x/tools/cmd/stringer -type VariableTypeHint +//go:generate go tool golang.org/x/tools/cmd/stringer -type VariableTypeHint // TypeHintNone indicates the absence of a type hint. Values specified in // ambiguous contexts will be treated as literal strings, as if TypeHintString diff --git a/internal/legacy/helper/schema/resource_data_get_source.go b/internal/legacy/helper/schema/resource_data_get_source.go index 096af9a348..513a937189 100644 --- a/internal/legacy/helper/schema/resource_data_get_source.go +++ b/internal/legacy/helper/schema/resource_data_get_source.go @@ -5,7 +5,7 @@ package schema -//go:generate go run golang.org/x/tools/cmd/stringer -type=getSource resource_data_get_source.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=getSource resource_data_get_source.go // getSource represents the level we want to get for a value (internally). // Any source less than or equal to the level will be loaded (whichever diff --git a/internal/legacy/helper/schema/valuetype.go b/internal/legacy/helper/schema/valuetype.go index 22954e7623..8847b91566 100644 --- a/internal/legacy/helper/schema/valuetype.go +++ b/internal/legacy/helper/schema/valuetype.go @@ -5,7 +5,7 @@ package schema -//go:generate go run golang.org/x/tools/cmd/stringer -type=ValueType valuetype.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=ValueType valuetype.go // ValueType is an enum of the type that can be represented by a schema. type ValueType int diff --git a/internal/legacy/tofu/instancetype.go b/internal/legacy/tofu/instancetype.go index 3217c59cea..3e58cf6800 100644 --- a/internal/legacy/tofu/instancetype.go +++ b/internal/legacy/tofu/instancetype.go @@ -5,7 +5,7 @@ package tofu -//go:generate go run golang.org/x/tools/cmd/stringer -type=InstanceType instancetype.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=InstanceType instancetype.go // InstanceType is an enum of the various types of instances store in the State type InstanceType int diff --git a/internal/legacy/tofu/resource_mode.go b/internal/legacy/tofu/resource_mode.go index a366f56c80..ba742f81bd 100644 --- a/internal/legacy/tofu/resource_mode.go +++ b/internal/legacy/tofu/resource_mode.go @@ -5,7 +5,7 @@ package tofu -//go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=ResourceMode -output=resource_mode_string.go resource_mode.go // ResourceMode is deprecated, use addrs.ResourceMode instead. // It has been preserved for backwards compatibility. diff --git a/internal/moduletest/status.go b/internal/moduletest/status.go index 249ab64047..61ab0ed14d 100644 --- a/internal/moduletest/status.go +++ b/internal/moduletest/status.go @@ -15,7 +15,7 @@ package moduletest // // See the Status.Merge function for this requirement being used in action. // -//go:generate go run golang.org/x/tools/cmd/stringer -type=Status status.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=Status status.go type Status int const ( diff --git a/internal/plans/action.go b/internal/plans/action.go index 85175b7153..b8a49a5034 100644 --- a/internal/plans/action.go +++ b/internal/plans/action.go @@ -22,7 +22,7 @@ const ( // Instead, we have hooks for those to show progress. ) -//go:generate go run golang.org/x/tools/cmd/stringer -type Action +//go:generate go tool golang.org/x/tools/cmd/stringer -type Action // IsReplace returns true if the action is one of the two actions that // represents replacing an existing object with a new object: diff --git a/internal/plans/changes.go b/internal/plans/changes.go index 785dc60a9d..e526274516 100644 --- a/internal/plans/changes.go +++ b/internal/plans/changes.go @@ -394,7 +394,7 @@ func (rc *ResourceInstanceChange) Simplify(destroying bool) *ResourceInstanceCha // apply step. type ResourceInstanceChangeActionReason rune -//go:generate go run golang.org/x/tools/cmd/stringer -type=ResourceInstanceChangeActionReason changes.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=ResourceInstanceChangeActionReason changes.go const ( // In most cases there's no special reason for choosing a particular diff --git a/internal/plans/mode.go b/internal/plans/mode.go index 7dfb594152..301c9795be 100644 --- a/internal/plans/mode.go +++ b/internal/plans/mode.go @@ -8,7 +8,7 @@ package plans // Mode represents the various mutually-exclusive modes for creating a plan. type Mode rune -//go:generate go run golang.org/x/tools/cmd/stringer -type Mode +//go:generate go tool golang.org/x/tools/cmd/stringer -type Mode const ( // NormalMode is the default planning mode, which aims to synchronize the diff --git a/internal/plans/quality.go b/internal/plans/quality.go index 85cd907fd8..a1c2ba3ef5 100644 --- a/internal/plans/quality.go +++ b/internal/plans/quality.go @@ -10,7 +10,7 @@ package plans // have multiple qualities. type Quality int -//go:generate go run golang.org/x/tools/cmd/stringer -type Quality +//go:generate go tool golang.org/x/tools/cmd/stringer -type Quality const ( // Errored plans did not successfully complete, and cannot be applied. diff --git a/internal/plugin/mock_proto/generate.go b/internal/plugin/mock_proto/generate.go index ff9bfe05fe..d667c511e5 100644 --- a/internal/plugin/mock_proto/generate.go +++ b/internal/plugin/mock_proto/generate.go @@ -3,6 +3,6 @@ // Copyright (c) 2023 HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run go.uber.org/mock/mockgen -destination mock.go github.com/opentofu/opentofu/internal/tfplugin5 ProviderClient,ProvisionerClient,Provisioner_ProvisionResourceClient,Provisioner_ProvisionResourceServer +//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/opentofu/opentofu/internal/tfplugin5 ProviderClient,ProvisionerClient,Provisioner_ProvisionResourceClient,Provisioner_ProvisionResourceServer package mock_tfplugin5 diff --git a/internal/plugin6/mock_proto/generate.go b/internal/plugin6/mock_proto/generate.go index 80fa0815d4..a57e763428 100644 --- a/internal/plugin6/mock_proto/generate.go +++ b/internal/plugin6/mock_proto/generate.go @@ -3,6 +3,6 @@ // Copyright (c) 2023 HashiCorp, Inc. // SPDX-License-Identifier: MPL-2.0 -//go:generate go run go.uber.org/mock/mockgen -destination mock.go github.com/opentofu/opentofu/internal/tfplugin6 ProviderClient +//go:generate go tool go.uber.org/mock/mockgen -destination mock.go github.com/opentofu/opentofu/internal/tfplugin6 ProviderClient package mock_tfplugin6 diff --git a/internal/providers/deferral.go b/internal/providers/deferral.go index 29af89332b..cf0190400d 100644 --- a/internal/providers/deferral.go +++ b/internal/providers/deferral.go @@ -14,7 +14,7 @@ import ( // the currently-available context. type DeferralReason int -//go:generate go run golang.org/x/tools/cmd/stringer -type=DeferralReason +//go:generate go tool golang.org/x/tools/cmd/stringer -type=DeferralReason const ( // DeferredReasonUnknown is the zero value of DeferralReason, used when diff --git a/internal/states/instance_object.go b/internal/states/instance_object.go index 9a1662ad94..f6ef017c9a 100644 --- a/internal/states/instance_object.go +++ b/internal/states/instance_object.go @@ -55,7 +55,7 @@ type ResourceInstanceObject struct { // ObjectStatus represents the status of a RemoteObject. type ObjectStatus rune -//go:generate go run golang.org/x/tools/cmd/stringer -type ObjectStatus +//go:generate go tool golang.org/x/tools/cmd/stringer -type ObjectStatus const ( // ObjectReady is an object status for an object that is ready to use. diff --git a/internal/states/statemgr/migrate.go b/internal/states/statemgr/migrate.go index de3105f131..23df216182 100644 --- a/internal/states/statemgr/migrate.go +++ b/internal/states/statemgr/migrate.go @@ -134,7 +134,7 @@ func Export(mgr Reader) *statefile.File { // is the receiver of that method and the "second" is the given argument. type SnapshotMetaRel rune -//go:generate go run golang.org/x/tools/cmd/stringer -type=SnapshotMetaRel +//go:generate go tool golang.org/x/tools/cmd/stringer -type=SnapshotMetaRel const ( // SnapshotOlder indicates that two snapshots have a common lineage and diff --git a/internal/tfdiags/diagnostic.go b/internal/tfdiags/diagnostic.go index 564eb4b4ed..56fc609519 100644 --- a/internal/tfdiags/diagnostic.go +++ b/internal/tfdiags/diagnostic.go @@ -31,7 +31,7 @@ type Diagnostic interface { type Severity rune -//go:generate go run golang.org/x/tools/cmd/stringer -type=Severity +//go:generate go tool golang.org/x/tools/cmd/stringer -type=Severity const ( Error Severity = 'E' diff --git a/internal/tofu/deprecation_level.go b/internal/tofu/deprecation_level.go index 4baf34c52c..ee2fd42ae3 100644 --- a/internal/tofu/deprecation_level.go +++ b/internal/tofu/deprecation_level.go @@ -5,7 +5,7 @@ package tofu -//go:generate go run golang.org/x/tools/cmd/stringer -type=DeprecationWarningLevel deprecation_level.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=DeprecationWarningLevel deprecation_level.go import ( "log" diff --git a/internal/tofu/graph_walk_operation.go b/internal/tofu/graph_walk_operation.go index 14e999220c..35bda8936d 100644 --- a/internal/tofu/graph_walk_operation.go +++ b/internal/tofu/graph_walk_operation.go @@ -5,7 +5,7 @@ package tofu -//go:generate go run golang.org/x/tools/cmd/stringer -type=walkOperation graph_walk_operation.go +//go:generate go tool golang.org/x/tools/cmd/stringer -type=walkOperation graph_walk_operation.go // walkOperation is an enum which tells the walkContext what to do. type walkOperation byte diff --git a/internal/tofu/node_resource_abstract_instance.go b/internal/tofu/node_resource_abstract_instance.go index b84c2f81ea..0427ede7b3 100644 --- a/internal/tofu/node_resource_abstract_instance.go +++ b/internal/tofu/node_resource_abstract_instance.go @@ -474,7 +474,7 @@ const ( prevRunState ) -//go:generate go run golang.org/x/tools/cmd/stringer -type phaseState +//go:generate go tool golang.org/x/tools/cmd/stringer -type phaseState // writeResourceInstanceState saves the given object as the current object for // the selected resource instance. diff --git a/internal/tofu/variables.go b/internal/tofu/variables.go index 44aff71802..bc83319c6b 100644 --- a/internal/tofu/variables.go +++ b/internal/tofu/variables.go @@ -139,7 +139,7 @@ func (v ValueSourceType) GoString() string { return fmt.Sprintf("tofu.%s", v) } -//go:generate go run golang.org/x/tools/cmd/stringer -type ValueSourceType +//go:generate go tool golang.org/x/tools/cmd/stringer -type ValueSourceType // InputValues is a map of InputValue instances. type InputValues map[string]*InputValue diff --git a/scripts/add-copyright-headers.sh b/scripts/add-copyright-headers.sh index 34b332701b..b004e5c74d 100755 --- a/scripts/add-copyright-headers.sh +++ b/scripts/add-copyright-headers.sh @@ -4,4 +4,4 @@ # Copyright (c) 2023 HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 -go run github.com/hashicorp/copywrite headers +go tool github.com/hashicorp/copywrite headers diff --git a/scripts/staticcheck.sh b/scripts/staticcheck.sh index 6e35fc43e6..4a09e3afc6 100755 --- a/scripts/staticcheck.sh +++ b/scripts/staticcheck.sh @@ -20,4 +20,4 @@ packages=$(go list ./... | egrep -v ${skip}) # may result in bugs. We also disable function deprecation checks (SA1019) # because our policy is to update deprecated calls locally while making other # nearby changes, rather than to make cross-cutting changes to update them all. -go run honnef.co/go/tools/cmd/staticcheck -checks 'all,-SA1019,-ST*' ${packages} +go tool honnef.co/go/tools/cmd/staticcheck -checks 'all,-SA1019,-ST*' ${packages} diff --git a/tools.go b/tools.go deleted file mode 100644 index bae84b9e7b..0000000000 --- a/tools.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) The OpenTofu Authors -// SPDX-License-Identifier: MPL-2.0 -// Copyright (c) 2023 HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -//go:build tools -// +build tools - -package tools - -// This file tracks some external tools we use during development and release -// processes. These are not used at runtime but having them here allows the -// Go toolchain to see that we need to include them in go.mod and go.sum. - -import ( - _ "github.com/hashicorp/copywrite" - _ "github.com/nishanths/exhaustive/cmd/exhaustive" - _ "golang.org/x/tools/cmd/stringer" - _ "honnef.co/go/tools/cmd/staticcheck" -) diff --git a/tools/tools.go b/tools/tools.go deleted file mode 100644 index e65f2746c7..0000000000 --- a/tools/tools.go +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) The OpenTofu Authors -// SPDX-License-Identifier: MPL-2.0 -// Copyright (c) 2023 HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -//go:build tools -// +build tools - -package tools - -import ( - _ "github.com/mitchellh/gox" - _ "github.com/nishanths/exhaustive" - _ "go.uber.org/mock/mockgen" - _ "golang.org/x/tools/cmd/stringer" - _ "google.golang.org/grpc/cmd/protoc-gen-go-grpc" - _ "honnef.co/go/tools/cmd/staticcheck" -)