Compile error in Windows - undefined: atomic.Bool, atomic.Int32

I am trying to compile my go program on Win10 and get the following errors:

PS grpc-echo>go build -v
github.com/openziti/identity
# github.com/openziti/identity
..\..\go\pkg\mod\github.com\openziti\identity@v1.0.12\identity.go:68:21: undefined: atomic.Bool
..\..\go\pkg\mod\github.com\openziti\identity@v1.0.12\identity.go:71:21: undefined: atomic.Int32
PS grpc-echo>

ā€œyourā€ go progam? What version of go are you using? where is your source code?

thereā€™s not enough information here to go on yet, I donā€™t think.

PS grpc-echo>go version
go version go1.18.6 windows/amd64
PS grpc-echo>

i mean - what git repo. you called it ā€˜yourā€™ code, is it in a repo I can look at?

github.com/openziti/sdk-golang v0.16.121

do you have go.mod/go.sum files that are not pushed?

Yes, the one in the repo was compiled on the linux ubuntu. I created a new one on windows to see if makes any difference locally.

Can you provide the full set of steps to reproduce? I canā€™t determine what you have done.

  1. I cloned the repo on my windows machine
  2. Deleted the go.mod and go.sum
  3. Ran go build
  1. ā€œthe repoā€ - i assume is ā€œgit clone GitHub - dariuszSki/grpc-echoā€. THEN i need to cd to grpc-echo.

  2. there are no go.mod nor go.sum files to delete

    grpc-echo$ ls go*
    ls: cannot access 'go*': No such file or directory
    
  3. go build doesnā€™t succeed becuase thereā€™s no go mod files and dependencies are not pulled etc.

I donā€™t know how to help you.

Sorry missed two steps:

  1. I cloned the repo on my windows machine
  2. Deleted the go.mod and go.sum
  3. go mod init grpc-echo
  4. go mod tidy
  5. go build

Thanks. I expected this was a golang 18 v 19 issue. I ran using 18 at first and got the same error. I upgraded to 1.19 and it buildsā€¦

You just need to get the latest 1.19+ of go.

1 Like

As simple as that :grin:. Thanks!

FYI, not sure if this is expected or not. When I use ziti-edge-tunnel for windows to enroll my identity, I get the following error when I run my app with this identity.

2022/09/19 07:27:30 failed to authenticate: failed to initialize context: (open -----BEGIN EC PRIVATE KEY-----
MHcCAQEEIM78CWnTAnZULFgo5S2ykT7byqDTIN7WIvSlbWKkPM1QoAoGCCqGSM49
AwEHoUQDQgAEzA/yguGeUgUKasLtqmK/LN53EOYfq2oA+gNRnpFaUCTqSHS/wMB+
53HEWKnYJS5qgpzLs2M1iJ4IQsulTvyO4g==
-----END EC PRIVATE KEY-----
: The filename, directory name, or volume label syntax is incorrect.)

I donā€™t get this error if I run my app with this identity in wsl. If I use identity enrolled by ziti-tunnel (go). Then it works in windows and in wsl without any issues. It is interesting that the go code compiled in Linux is able to interpret ec private key but in windows it throws an error. The RSA key generated by the ziti-tunnel works. Is that expected, or I am doing something wrong?

Did you use ziti-edge-tunnel to enroll the identity or did you use ziti CLI? I have absolutely had this exact issue before, but I thought I used ziti edge enroll to enroll the identity, not ziti-edge-tunnel.

Regardless, itā€™s something I would not expect either and itā€™s a bug. Would you file an issue for this in Issues Ā· openziti/ziti-tunnel-sdk-c Ā· GitHub with exact steps to reproduce?

ok will do, I used ziti-edge-tunnel enroll vs ziti-tunnel enroll

is this ziti-tunnel-sdk-c issue? or golang-sdk issue?

File the issue on ziti-tunnel-sdk-c, please add exact steps to reproduce. weā€™ll move it if needed. :slight_smile:

Done. App built with golang sdk in windows throws an private key error with Identities enrolled in Windows by ZET Ā· Issue #489 Ā· openziti/ziti-tunnel-sdk-c Ā· GitHub