burrowers / garble

Obfuscate Go builds
BSD 3-Clause "New" or "Revised" License
4.04k stars 257 forks source link

Errors while working with anonymous structs #842

Open linted opened 7 months ago

linted commented 7 months ago

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 amd64
            GOOS linux
         GOAMD64 v1
$ go version
go version go1.21.6 linux/amd64

What environment are you running Garble on?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='local'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD=''
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1325620773=/tmp/go-build -g

What did you do?

# git clone https://github.com/libp2p/go-libp2p.git
# cd go-libp2p/examples/chat
# garble build

What did you expect to see?

garble to be able to build the examples from this popular library.

What did you see instead?

/go-libp2p/examples/chat# garble build
# github.com/libp2p/go-libp2p/p2p/protocol/holepunch
Kc_daTySOcx.go:1: cannot use make(map[peer.ID]struct{bBnKb2bxZ8V4 int; nnXie6 time.FVJzTyFdo}) (value of type map[RFoWLhGaEDb.ID]struct{bBnKb2bxZ8V4 int; nnXie6 gvdD72.FVJzTyFdo}) as map[RFoWLhGaEDb.ID]struct{counter int; last gvdD72.FVJzTyFdo} value in struct literal
HK5CVSzxh4D4.go:1: cannot use make(map[peer.ID]struct{bBnKb2bxZ8V4 int; nnXie6 time.FVJzTyFdo}) (value of type map[RFoWLhGaEDb.ID]struct{bBnKb2bxZ8V4 int; nnXie6 gvdD72.FVJzTyFdo}) as map[RFoWLhGaEDb.ID]struct{counter int; last gvdD72.FVJzTyFdo} value in struct literal
OmJ69f.go:1: cannot use make(map[peer.ID]struct{bBnKb2bxZ8V4 int; nnXie6 time.FVJzTyFdo}) (value of type map[RFoWLhGaEDb.ID]struct{bBnKb2bxZ8V4 int; nnXie6 gvdD72.FVJzTyFdo}) as map[RFoWLhGaEDb.ID]struct{counter int; last gvdD72.FVJzTyFdo} value in struct literal
exit status 2
exit status 1
mvdan commented 7 months ago

v0.11.0 is pretty old. Have you tried with the latest stable version and master?

linted commented 7 months ago

You're right, I didn't notice I was using an old version. This is what I get after updating, which appears to be the same error.

# garble version
mvdan.cc/garble v0.12.1

Build settings:
      -buildmode exe
       -compiler gc
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
# garble build
# github.com/libp2p/go-libp2p/p2p/protocol/holepunch
HtiNa9cD6f.go:1: cannot use make(map[peer.ID]struct{g7OR7KZxrxF int; gmni7cw time.Elg7daBRDEu}) (value of type map[XaEgkY.ID]struct{g7OR7KZxrxF int; gmni7cw zGPEB0e1.Elg7daBRDEu}) as map[XaEgkY.ID]struct{counter int; last zGPEB0e1.Elg7daBRDEu} value in struct literal
cgXBPv5kb7aG.go:1: cannot use make(map[peer.ID]struct{g7OR7KZxrxF int; gmni7cw time.Elg7daBRDEu}) (value of type map[XaEgkY.ID]struct{g7OR7KZxrxF int; gmni7cw zGPEB0e1.Elg7daBRDEu}) as map[XaEgkY.ID]struct{counter int; last zGPEB0e1.Elg7daBRDEu} value in struct literal
whUWrW.go:1: cannot use make(map[peer.ID]struct{g7OR7KZxrxF int; gmni7cw time.Elg7daBRDEu}) (value of type map[XaEgkY.ID]struct{g7OR7KZxrxF int; gmni7cw zGPEB0e1.Elg7daBRDEu}) as map[XaEgkY.ID]struct{counter int; last zGPEB0e1.Elg7daBRDEu} value in struct literal
exit status 2
exit status 1