Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion acctest/pluginacc.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestPlugin(t *testing.T, testCase *PluginTestCase) {
logfile := fmt.Sprintf("packer_log_%s.txt", testCase.Name)

extension := ".pkr.hcl"
if err := json.Unmarshal([]byte(testCase.Template), &(map[string]interface{}{})); err == nil {
if err := json.Unmarshal([]byte(testCase.Template), &(map[string]any{})); err == nil {
extension = ".json"
}
templatePath := fmt.Sprintf("./%s%s", testCase.Name, extension)
Expand Down
4 changes: 2 additions & 2 deletions adapter/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,5 @@ func (fi fileInfo) ModTime() time.Time {
}
return fi.mtime
}
func (fi fileInfo) IsDir() bool { return fi.mode.IsDir() }
func (fi fileInfo) Sys() interface{} { return nil }
func (fi fileInfo) IsDir() bool { return fi.mode.IsDir() }
func (fi fileInfo) Sys() any { return nil }
2 changes: 1 addition & 1 deletion bootcommand/boot_command_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func GenerateExpressionSequence(command string) (expressionSequence, error) {
if err != nil {
return nil, err
}
for _, exp := range got.([]interface{}) {
for _, exp := range got.([]any) {
seq = append(seq, exp.(expression))
}
return seq, nil
Expand Down
2 changes: 1 addition & 1 deletion chroot/communicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestCommunicator_ImplementsCommunicator(t *testing.T) {
var raw interface{} = &Communicator{}
var raw any = &Communicator{}

if _, ok := raw.(packersdk.Communicator); !ok {
t.Fatalf("Communicator should be a communicator")
Expand Down
2 changes: 1 addition & 1 deletion chroot/step_copy_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func testUI() (packersdk.Ui, func() string) {
}

func TestCopyFilesCleanupFunc_ImplementsCleanupFunc(t *testing.T) {
var raw interface{} = new(StepCopyFiles)
var raw any = new(StepCopyFiles)
if _, ok := raw.(Cleanup); !ok {
t.Fatalf("cleanup func should be a CleanupFunc")
}
Expand Down
2 changes: 1 addition & 1 deletion chroot/step_mount_extra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package chroot
import "testing"

func TestMountExtraCleanupFunc_ImplementsCleanupFunc(t *testing.T) {
var raw interface{} = new(StepMountExtra)
var raw any = new(StepMountExtra)
if _, ok := raw.(Cleanup); !ok {
t.Fatalf("cleanup func should be a CleanupFunc")
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/packer-sdc/internal/fix/testdata/fixed/basic/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/packer-plugin-sdk v0.3.1/go.mod h1:+GzydiXdn0CkueigqXBsX4Poz5gfmFXZ/DkxKt4fmt4=
github.com/nywilken/go-cty v1.13.3/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ module example

require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
github.com/google/go-cmp v0.3.0
github.com/hashicorp/go-cleanhttp v0.5.0
github.com/hashicorp/go-multierror v1.1.0
github.com/google/go-cmp v0.5.9
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/go-safetemp v1.0.0
github.com/hashicorp/go-version v1.1.0
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/packer-plugin-sdk v0.4.0
github.com/klauspost/compress v1.11.2
github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/go-testing-interface v1.0.0
github.com/ulikunitz/xz v0.5.8
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/go-testing-interface v1.14.1
github.com/ulikunitz/xz v0.5.10
)

require github.com/hashicorp/errwrap v1.0.0 // indirect
require github.com/hashicorp/errwrap v1.1.0 // indirect

go 1.18
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/packer-plugin-sdk v0.4.0/go.mod h1:uNhU3pmjM2ejgHYce/g4J+sa5rh81iYQztpGvGa5FOs=
github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module example

require (
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d
github.com/google/go-cmp v0.3.0
github.com/google/go-cmp v0.3.1
github.com/hashicorp/go-cleanhttp v0.5.0
github.com/hashicorp/go-multierror v1.1.0
github.com/hashicorp/go-safetemp v1.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoDHxNAB65b+Rj1I=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/zclconf/go-cty v1.13.1/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0=
23 changes: 23 additions & 0 deletions cmd/packer-sdc/internal/fix/testdata/unfixed/basic/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/packer-plugin-sdk v0.3.1/go.mod h1:+GzydiXdn0CkueigqXBsX4Poz5gfmFXZ/DkxKt4fmt4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
github.com/zclconf/go-cty v1.10.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
23 changes: 23 additions & 0 deletions cmd/packer-sdc/internal/fix/testdata/unfixed/version/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/hcl/v2 v2.13.0/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/packer-plugin-sdk v0.3.1/go.mod h1:+GzydiXdn0CkueigqXBsX4Poz5gfmFXZ/DkxKt4fmt4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/nywilken/go-cty v1.12.1/go.mod h1:jQhMnBcOB2DrBaV2awY4z+oSZTPc2dnnwGqYqFo86G0=
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func outputHCL2SpecField(w io.Writer, accessor string, fieldType types.Type, tag
// a cty.Type or a string. The second argument is used for recursion and is the
// type that will be used by the parent. For example when fieldType is a []string; a
// recursive goFieldToCtyType call will return a cty.String.
func goFieldToCtyType(accessor string, fieldType types.Type) (interface{}, cty.Type) {
func goFieldToCtyType(accessor string, fieldType types.Type) (any, cty.Type) {
switch f := fieldType.(type) {
case *types.Pointer:
return goFieldToCtyType(accessor, f.Elem())
Expand Down
4 changes: 2 additions & 2 deletions communicator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,13 @@ func (c *SSH) ConfigSpec() hcldec.ObjectSpec { return c.FlatMapstructure().HCL2S
func (c *WinRM) ConfigSpec() hcldec.ObjectSpec { return c.FlatMapstructure().HCL2Spec() }

// Configure parses the json template into the Config structs
func (c *SSH) Configure(raws ...interface{}) ([]string, error) {
func (c *SSH) Configure(raws ...any) ([]string, error) {
err := config.Decode(c, nil, raws...)
return nil, err
}

// Configure parses the json template into the Config structs
func (c *WinRM) Configure(raws ...interface{}) ([]string, error) {
func (c *WinRM) Configure(raws ...any) ([]string, error) {
err := config.Decode(c, nil, raws...)
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion communicator/sshkey/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Pair struct {
Public []byte
}

func NewPair(public, private interface{}) (*Pair, error) {
func NewPair(public, private any) (*Pair, error) {
kb, err := x509.MarshalPKCS8PrivateKey(private)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions guestexec/elevated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
)

func testConfig() map[string]interface{} {
return map[string]interface{}{
"inline": []interface{}{"foo", "bar"},
func testConfig() map[string]any {
return map[string]any{
"inline": []any{"foo", "bar"},
}
}

Expand Down
12 changes: 6 additions & 6 deletions hcl2helper/values.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const UnknownVariableValue = "74D93920-ED26-11E3-AC10-0800200C9A66"

// HCL2ValueFromConfigValue takes a value turns it into
// a cty.Value so it can be used within, for example, an HCL2 EvalContext.
func HCL2ValueFromConfigValue(v interface{}) cty.Value {
func HCL2ValueFromConfigValue(v any) cty.Value {
if v == nil {
return cty.NullVal(cty.DynamicPseudoType)
}
Expand All @@ -39,7 +39,7 @@ func HCL2ValueFromConfigValue(v interface{}) cty.Value {
return cty.NumberIntVal(int64(tv))
case float64:
return cty.NumberFloatVal(tv)
case []interface{}:
case []any:
vals := make([]cty.Value, len(tv))
for i, ev := range tv {
vals[i] = HCL2ValueFromConfigValue(ev)
Expand All @@ -51,7 +51,7 @@ func HCL2ValueFromConfigValue(v interface{}) cty.Value {
vals[i] = cty.StringVal(ev)
}
return cty.ListVal(vals)
case map[string]interface{}:
case map[string]any:
vals := map[string]cty.Value{}
for k, ev := range tv {
vals[k] = HCL2ValueFromConfigValue(ev)
Expand All @@ -66,8 +66,8 @@ func HCL2ValueFromConfigValue(v interface{}) cty.Value {

// HCL2ValueFromConfig takes a struct with it's map of hcldec.Spec, and turns it into
// a cty.Value so it can be used as, for example, a Datasource value.
func HCL2ValueFromConfig(conf interface{}, configSpec map[string]hcldec.Spec) cty.Value {
c := map[string]interface{}{}
func HCL2ValueFromConfig(conf any, configSpec map[string]hcldec.Spec) cty.Value {
c := map[string]any{}
if err := mapstructure.Decode(conf, &c); err != nil {
panic(fmt.Errorf("can't convert %#v to cty.Value", conf))
}
Expand Down Expand Up @@ -102,7 +102,7 @@ If this doesn't fix your problem, this is likely a Packer bug, please consider o
// This should be a slice of objects, so we need to take a special care
if hcldec.ImpliedType(st.Nested).IsObjectType() {
res := []cty.Value{}
c := []interface{}{}
c := []any{}
if err := mapstructure.Decode(v, &c); err != nil {
panic(fmt.Errorf("can't convert %#v to cty.Value", conf))
}
Expand Down
14 changes: 7 additions & 7 deletions hcl2helper/values_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func TestHCL2ValueFromConfigValue(t *testing.T) {
tests := []struct {
Name string
Input interface{}
Input any
Want cty.Value
}{
{
Expand Down Expand Up @@ -46,11 +46,11 @@ func TestHCL2ValueFromConfigValue(t *testing.T) {
},
{
Name: "nested map[string]interface{}",
Input: map[string]interface{}{
Input: map[string]any{
"name": "Ermintrude",
"age": int(19),
"address": map[string]interface{}{
"street": []interface{}{"421 Shoreham Loop"},
"address": map[string]any{
"street": []any{"421 Shoreham Loop"},
"city": "Fridgewater",
"state": "MA",
"zip": "91037",
Expand All @@ -69,7 +69,7 @@ func TestHCL2ValueFromConfigValue(t *testing.T) {
},
{
Name: "simple map[string]interface{}",
Input: map[string]interface{}{
Input: map[string]any{
"foo": "bar",
"bar": "baz",
},
Expand All @@ -80,7 +80,7 @@ func TestHCL2ValueFromConfigValue(t *testing.T) {
},
{
Name: "[]interface{} as tuple",
Input: []interface{}{
Input: []any{
"foo",
true,
},
Expand Down Expand Up @@ -127,7 +127,7 @@ func TestHCL2ValueFromConfigValue(t *testing.T) {
func TestHCL2ValueFromConfig(t *testing.T) {
tests := []struct {
Name string
Input interface{}
Input any
Spec map[string]hcldec.Spec
Want cty.Value
}{
Expand Down
2 changes: 1 addition & 1 deletion json/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

// Unmarshal is wrapper around json.Unmarshal that returns user-friendly
// errors when there are syntax errors.
func Unmarshal(data []byte, i interface{}) error {
func Unmarshal(data []byte, i any) error {
err := json.Unmarshal(data, i)
if err != nil {
syntaxErr, ok := err.(*json.SyntaxError)
Expand Down
2 changes: 1 addition & 1 deletion multistep/basic_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

func TestBasicRunner_ImplRunner(t *testing.T) {
var raw interface{} = &BasicRunner{}
var raw any = &BasicRunner{}
if _, ok := raw.(Runner); !ok {
t.Fatalf("BasicRunner must be a Runner")
}
Expand Down
2 changes: 1 addition & 1 deletion multistep/commonsteps/multistep_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func NewRunnerWithPauseFn(steps []multistep.Step, config common.PackerConfig, ui
return runner
}

func typeName(i interface{}) string {
func typeName(i any) string {
return reflect.Indirect(reflect.ValueOf(i)).Type().Name()
}

Expand Down
2 changes: 1 addition & 1 deletion multistep/commonsteps/step_create_cdrom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func TestStepCreateCD_Impl(t *testing.T) {
var raw interface{} = new(StepCreateCD)
var raw any = new(StepCreateCD)
if _, ok := raw.(multistep.Step); !ok {
t.Fatalf("StepCreateCD should be a step")
}
Expand Down
2 changes: 1 addition & 1 deletion multistep/commonsteps/step_create_floppy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
const TestFixtures = "test-fixtures"

func TestStepCreateFloppy_Impl(t *testing.T) {
var raw interface{} = new(StepCreateFloppy)
var raw any = new(StepCreateFloppy)
if _, ok := raw.(multistep.Step); !ok {
t.Fatalf("StepCreateFloppy should be a step")
}
Expand Down
2 changes: 1 addition & 1 deletion multistep/commonsteps/step_http_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestStepHTTPServer_Run(t *testing.T) {
tests := []struct {
cfg *HTTPConfig
want multistep.StepAction
wantPort interface{}
wantPort any
wantContent map[string]string
}{
{
Expand Down
6 changes: 3 additions & 3 deletions multistep/commonsteps/step_provision.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const HttpIPNotImplemented = "ERR_HTTP_IP_NOT_IMPLEMENTED_BY_BUILDER"
const HttpPortNotImplemented = "ERR_HTTP_PORT_NOT_IMPLEMENTED_BY_BUILDER"
const HttpAddrNotImplemented = "ERR_HTTP_ADDR_NOT_IMPLEMENTED_BY_BUILDER"

func PopulateProvisionHookData(state multistep.StateBag) map[string]interface{} {
hookData := make(map[string]interface{})
func PopulateProvisionHookData(state multistep.StateBag) map[string]any {
hookData := make(map[string]any)

// Load Builder hook data from state, if it has been set.
hd, ok := state.GetOk("generated_data")
if ok {
hookData = hd.(map[string]interface{})
hookData = hd.(map[string]any)
}

// Warn user that the id isn't implemented
Expand Down
Loading
Loading