GithubHelp home page GithubHelp logo

Go version does not build. about tink HOT 12 CLOSED

google avatar google commented on July 19, 2024
Go version does not build.

from tink.

Comments (12)

dgryski avatar dgryski commented on July 19, 2024 1

Fails with the regular Go tooling, but I see it needs bazel to build. Closing.

from tink.

thaidn avatar thaidn commented on July 19, 2024

Hey I want to make it work with the regular Go tooling too. Can you tell me the errors that you encountered? I'm new to Go...

from tink.

dgryski avatar dgryski commented on July 19, 2024

From the tink/go directory,

So, it seems like at least the protobuf descriptions aren't committed to the repository which is common for Go projects so they can be build directly with go get.

$ go build ./...
aead/aead_key_templates.go:21:2: cannot find package "github.com/google/tink/proto/aes_gcm_proto" in any of:
	/Users/dgryski/work/src/go/src/github.com/google/tink/proto/aes_gcm_proto (from $GOROOT)
	/Users/dgryski/go/src/github.com/google/tink/proto/aes_gcm_proto (from $GOPATH)
tink/proto_util.go:20:2: cannot find package "github.com/google/tink/proto/common_proto" in any of:
	/Users/dgryski/work/src/go/src/github.com/google/tink/proto/common_proto (from $GOROOT)
	/Users/dgryski/go/src/github.com/google/tink/proto/common_proto (from $GOPATH)
tink/cleartext_keyset_handle.go:22:2: cannot find package "github.com/google/tink/proto/tink_proto" in any of:
	/Users/dgryski/work/src/go/src/github.com/google/tink/proto/tink_proto (from $GOROOT)
	/Users/dgryski/go/src/github.com/google/tink/proto/tink_proto (from $GOPATH)
mac/hmac_key_manager.go:22:2: found packages mac (hmac.go) and hmac (hmac_test.go) in /Users/dgryski/go/src/github.com/google/tink/go/subtle/mac
mac/hmac_key_manager.go:25:2: cannot find package "github.com/google/tink/proto/hmac_proto" in any of:
	/Users/dgryski/work/src/go/src/github.com/google/tink/proto/hmac_proto (from $GOROOT)
	/Users/dgryski/go/src/github.com/google/tink/proto/hmac_proto (from $GOPATH)
signature/ecdsa_sign_key_manager.go:27:2: cannot find package "github.com/google/tink/proto/ecdsa_proto" in any of:
	/Users/dgryski/work/src/go/src/github.com/google/tink/proto/ecdsa_proto (from $GOROOT)
	/Users/dgryski/go/src/github.com/google/tink/proto/ecdsa_proto (from $GOPATH)
can't load package: mac/hmac_key_manager.go:22:2: found packages mac (hmac.go) and hmac (hmac_test.go) in /Users/dgryski/go/src/github.com/google/tink/go/subtle/mac

The mac vs hmac naming issue is a small quick fix.

from tink.

thaidn avatar thaidn commented on July 19, 2024

Thanks, I'll generate the proto code.

from tink.

thaidn avatar thaidn commented on July 19, 2024

I'm using
go version
go version go1.8.1 darwin/amd64

Here's what I did and the errors that I got:

$ pwd
/Users/thaidn/tink/cloudcryptosdk/go # cloudcryptosdk was our code name for Tink
$ cd go/
$ go build ./...
aead/aes_gcm_key_manager.go:22:2: cannot find package "github.com/google/tink/go/subtle/aead" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/subtle/aead (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/subtle/aead (from $GOPATH)
aead/aes_gcm_key_manager.go:23:2: cannot find package "github.com/google/tink/go/subtle/random" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/subtle/random (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/subtle/random (from $GOPATH)
aead/aead_config.go:20:2: cannot find package "github.com/google/tink/go/tink" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/tink (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/tink (from $GOPATH)
aead/aead_key_templates.go:21:2: cannot find package "github.com/google/tink/proto/aes_gcm_proto" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/proto/aes_gcm_proto (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/proto/aes_gcm_proto (from $GOPATH)
mac/hmac_key_manager.go:22:2: cannot find package "github.com/google/tink/go/subtle/mac" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/subtle/mac (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/subtle/mac (from $GOPATH)
mac/mac_key_templates.go:21:2: cannot find package "github.com/google/tink/proto/common_proto" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/proto/common_proto (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/proto/common_proto (from $GOPATH)
mac/hmac_key_manager.go:25:2: cannot find package "github.com/google/tink/proto/hmac_proto" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/proto/hmac_proto (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/proto/hmac_proto (from $GOPATH)
signature/ecdsa_sign_key_manager.go:24:2: cannot find package "github.com/google/tink/go/subtle" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/subtle (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/subtle (from $GOPATH)
signature/ecdsa_sign_key_manager.go:25:2: cannot find package "github.com/google/tink/go/subtle/signature" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/subtle/signature (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/subtle/signature (from $GOPATH)
signature/ecdsa_sign_key_manager.go:27:2: cannot find package "github.com/google/tink/proto/ecdsa_proto" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/proto/ecdsa_proto (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/proto/ecdsa_proto (from $GOPATH)
testutil/testutil.go:24:2: cannot find package "github.com/google/tink/go/aead" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/aead (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/aead (from $GOPATH)
testutil/testutil.go:25:2: cannot find package "github.com/google/tink/go/mac" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/mac (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/mac (from $GOPATH)
testutil/testutil.go:26:2: cannot find package "github.com/google/tink/go/signature" in any of:
/usr/local/Cellar/go/1.8.1/libexec/src/github.com/google/tink/go/signature (from $GOROOT)
/Users/thaidn/go/src/github.com/google/tink/go/signature (from $GOPATH)

It seems that go build cannot figure out that the prefix of my package is github.com/google/tink. What I should do?

from tink.

thaidn avatar thaidn commented on July 19, 2024

My GOPATH points to /Users/thaidn/go.

from tink.

Saqibm128 avatar Saqibm128 commented on July 19, 2024

the build.bazel is in tink/go/tink. If you run go build *.go there, you get the usual proto errors. I think that might be the correct directory to build?

from tink.

dgryski avatar dgryski commented on July 19, 2024

Normally the directory structure is expected to mirror the package name. For this kind of shared-language repo, it's not uncommon to have go in the package path. For example Vitess's packages are all at github.com/youtube/vitess/go: https://godoc.org/github.com/youtube/vitess/go .

If you checkout the repository into /Users/thaidn/go/src/github.com/google/tink then packages should be found (after updating the imports to be github.com/google/tink/go/aead, etc)

from tink.

thaidn avatar thaidn commented on July 19, 2024

Thanks for the instructions, I appreciate it.

With my pending PR, go get github.com/google/tink/go/aead works now, but go get github.com/google/tink/go doesn't because I don't actually have any Go code in https://github.com/google/tink/tree/master/go. Is there a trick or convention that allows me to ensure all Tink packages are downloaded and installed with a single command?

from tink.

dgryski avatar dgryski commented on July 19, 2024

You can use go get github.com/google/tink/go/... where ... means "all packages under this directory".

from tink.

thaidn avatar thaidn commented on July 19, 2024

Thanks!

With b081da6, I think go get github.com/google/tink/go/... should work now. Please help verify.

You're more than welcome to play with the Go code and tell us what you think, but please don't use it in production.

from tink.

dgryski avatar dgryski commented on July 19, 2024
$ go get -v -u github.com/google/tink/go/...
github.com/google/tink (download)
github.com/golang/protobuf (download)
github.com/google/tink/go/subtle
github.com/google/tink/go/subtle/random
github.com/golang/protobuf/proto
github.com/google/tink/proto/tink_proto
github.com/google/tink/proto/common_proto
github.com/google/tink/proto/aes_gcm_proto
github.com/google/tink/proto/hmac_proto
github.com/google/tink/proto/ecdsa_proto
github.com/google/tink/go/tink
github.com/google/tink/go/subtle/mac
github.com/google/tink/go/subtle/aead
github.com/google/tink/go/subtle/signature
github.com/google/tink/go/aead
github.com/google/tink/go/mac
github.com/google/tink/go/signature
github.com/google/tink/go/testutil

LGTM. Thanks!

from tink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.