Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerd module causes an EmbeddedAliasFields panic #827

Open
chkp-alonma opened this issue Jan 15, 2024 · 1 comment
Open

containerd module causes an EmbeddedAliasFields panic #827

chkp-alonma opened this issue Jan 15, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@chkp-alonma
Copy link

What version of Garble and Go are you using?

$ garble version
mvdan.cc/garble v0.11.0

Build settings:
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH arm64
            GOOS darwin
$ go version
go version go1.21.3 darwin/arm64

What environment are you running Garble on?

go env Output
$ go env
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/alonma/Library/Caches/go-build'
GOENV='/Users/alonma/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/alonma/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/alonma/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.21.3'
GCCGO='gccgo'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/alonma/projects/syft/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/yc/b45c2c412rb_dkjb1gd1bmbw0000gq/T/go-build1268150911=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I tried building my project with garble

What did you expect to see?

Build going through and go binary

What did you see instead?

error pointing to containerd package

build output
# github.com/containerd/containerd/remotes/docker/config
panic: EmbeddedAliasFields pointed "github.com/containerd/containerd/remotes/docker/config.HostFileConfig - hosts.go:372" to a missing type {"github.com/containerd/containerd/remotes/docker/config" "HostFileConfig"} [recovered]
	panic: EmbeddedAliasFields pointed "github.com/containerd/containerd/remotes/docker/config.HostFileConfig - hosts.go:372" to a missing type {"github.com/containerd/containerd/remotes/docker/config" "HostFileConfig"}

goroutine 1 [running]:
golang.org/x/tools/go/ast/astutil.Apply.func1()
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:48 +0xb8
panic({0x10331cac0?, 0x14000e103c0?})
/usr/local/go/src/runtime/panic.go:914 +0x218
main.(*transformer).transformGoFile.func1(0x14000ad8310)
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:1916 +0xe9c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103387bd0?, 0x14000aacc00?}, {0x103272def?, 0x5?}, 0x10302d710?, {0x103387b08?, 0x14000aab780?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:199 +0x180
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x1033884e0?, 0x14000aa13e0?}, {0x103272ecb?, 0x10?}, 0x14000e80000?, {0x103387bd0?, 0x14000aacc00?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:222 +0x280
golang.org/x/tools/go/ast/astutil.(*application).applyList(0x14000ad8300, {0x1033884e0?, 0x14000aa13e0}, {0x103272ecb, 0x4})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:484 +0x7c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103388620?, 0x14000a95818?}, {0x1032735fd?, 0x10?}, 0x14000e80000?, {0x1033884e0?, 0x14000aa13e0?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:227 +0x314
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x1033882b0?, 0x14000aaccc0?}, {0x103272def?, 0x14000838f18?}, 0x10302d710?, {0x103388620?, 0x14000a95818?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:293 +0xc10
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103388120?, 0x14000aacd00?}, {0x103272c5e?, 0x0?}, 0x0?, {0x1033882b0?, 0x14000aaccc0?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:241 +0x47c
golang.org/x/tools/go/ast/astutil.(*application).applyList(0x14000ad8300, {0x103388120?, 0x14000aacd00}, {0x103272c5e, 0x3})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:484 +0x7c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103388148?, 0x14000aa1620?}, {0x103272ecb?, 0x103318da0?}, 0x0?, {0x103388120?, 0x14000aacd00?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:338 +0x10e8
golang.org/x/tools/go/ast/astutil.(*application).applyList(0x14000ad8300, {0x103388148?, 0x14000aa1620}, {0x103272ecb, 0x4})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:484 +0x7c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103387b58?, 0x14000aa1650?}, {0x103272df3?, 0x140008394b8?}, 0x10302d710?, {0x103388148?, 0x14000aa1620?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:353 +0x121c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103387b30?, 0x1400089e960?}, {0x103273271?, 0x14000839668?}, 0x102fbc92c?, {0x103387b58?, 0x14000aa1650?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:429 +0x1cac
golang.org/x/tools/go/ast/astutil.(*application).applyList(0x14000ad8300, {0x103387b30?, 0x1400089e960}, {0x103273271, 0x5})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:484 +0x7c
golang.org/x/tools/go/ast/astutil.(*application).apply(0x14000ad8300, {0x103388990?, 0x14000ae49b0?}, {0x103272ec7?, 0x64?}, 0x55?, {0x103387b30?, 0x1400089e960?})
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:435 +0x1d40
golang.org/x/tools/go/ast/astutil.Apply({0x103387b30?, 0x1400089e960}, 0x14000ae4990, 0x14000ae49a0)
../../../../go/pkg/mod/golang.org/x/tools@v0.15.0/go/ast/astutil/rewrite.go:53 +0x110
main.(*transformer).transformGoFile(0x14000083200, 0x14000aa6200?)
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:2082 +0xf4
main.(*transformer).transformCompile(0x14000083200, {0x140000201b0?, 0x140000260b4?, 0x36?})
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:1042 +0x950
main.mainErr({0x14000020190, 0x16, 0x10358e100?})
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:457 +0x740
main.main1()
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:254 +0x21c
main.main()
../../../../go/pkg/mod/mvdan.cc/garble@v0.11.0/main.go:146 +0x1c
exit status 1

@lu4p lu4p added the bug Something isn't working label Jan 16, 2024
@mvdan
Copy link
Member

mvdan commented Feb 18, 2024

We will solve this class of bugs entirely when we can start using alias tracking in Go 1.22/1.23 per golang/go#63223 and golang/go#64208.

I tried giving the early support in Go 1.22 a try, but I ran into a panic (golang/go#65778), so I think it's too early.

@mvdan mvdan changed the title Unable to garble build with containerd dependency containerd module causes a EmbeddedAliasFields panic Feb 18, 2024
@mvdan mvdan changed the title containerd module causes a EmbeddedAliasFields panic containerd module causes an EmbeddedAliasFields panic Feb 18, 2024
@mvdan mvdan self-assigned this Mar 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants