Closed bluecmd closed 6 years ago
Indeed, I'm really sorry about this ugliness. This should be resolved by this PR https://github.com/cloudflare/roughtime/pull/6 once it lands.
In the meantime, checkout this branch, then import "github.com/cloudflare/roughtime/config" instead of "roughtime.googlesource.com/.../config". Hope that helps!
Super! :) I've worked around it by taking all your code and temporarily imported it and hacked it together in my own fork, but I'll make sure to sync back to your version when it is fixed.
PR #6 has been merged--importing "github.com/cloudflare/roughtime/config" should now work for you on master branch. :) Feel-free to open another issue if other vendoring issues crop up. I'm going to contact the google folks to see if they can make their roughtime-library go-gettable so we can properly vendor it.
Update: I fixed vendoring such that importing from "roughtime.googlesource.com/roughtime.git/go/protocol" and "roughtime.googlesource.com/roughtime.git/go/config" should now work. Let me know if there are any other issues!
[bluecmd]$ git diff . [ttime] [14:39:49]
diff --git a/pkg/bmc/ttime/roughtime.go b/pkg/bmc/ttime/roughtime.go
index fd2a462..b65e702 100644
--- a/pkg/bmc/ttime/roughtime.go
+++ b/pkg/bmc/ttime/roughtime.go
@@ -11,9 +11,9 @@ import (
"time"
"github.com/beevik/ntp"
- "github.com/u-root/u-bmc/pkg/roughtime"
- "github.com/u-root/u-bmc/pkg/roughtime/upstream/config"
+ "github.com/cloudflare/roughtime"
"golang.org/x/sync/errgroup"
+ "roughtime.googlesource.com/roughtime.git/go/config"
)
const (
[bluecmd]$ go get [ttime] [14:39:51]
# github.com/u-root/u-bmc/pkg/bmc/ttime
./roughtime.go:52:29: cannot use srv (type *"roughtime.googlesource.com/roughtime.git/go/config".Server) as type *"github.com/cloudflare/roughtime/vendor/roughtime.googlesource.com/go/config".Server in argument to roughtime.Get
:( Any ideas?
Ping @gabbifish, not sure how visible a single comment is in a closed issue :)
Hi there! I'm so sorry for the delay. Have you re-pulled our repository since my last PR? Perhaps you're working on an old version of cloudflare/roughtime--the path github.com/cloudflare/roughtime/vendor/roughtime.googlesource.com/go/config
should no longer exist in the most recent version of the cloudflare/roughtime repository. (It is now github.com/cloudflare/roughtime/vendor/roughtime.googlesource.com/roughtime.git/go/config/
).
I apparently hadn't, which I do apologize for, but the error remains (slighty modified):
[bluecmd]$ git reflog
ba5e314 (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: pull --ff-only: Fast-forward
a00510d HEAD@{1}: clone: from https://github.com/cloudflare/roughtime
[bluecmd]$ pwd
/home/bluecmd/go/src/github.com/cloudflare/roughtime
Trying to build my thing:
[bluecmd]$ git diff
diff --git a/pkg/bmc/ttime/roughtime.go b/pkg/bmc/ttime/roughtime.go
index fd2a462..b65e702 100644
--- a/pkg/bmc/ttime/roughtime.go
+++ b/pkg/bmc/ttime/roughtime.go
@@ -11,9 +11,9 @@ import (
"time"
"github.com/beevik/ntp"
- "github.com/u-root/u-bmc/pkg/roughtime"
- "github.com/u-root/u-bmc/pkg/roughtime/upstream/config"
+ "github.com/cloudflare/roughtime"
"golang.org/x/sync/errgroup"
+ "roughtime.googlesource.com/roughtime.git/go/config"
)
const (
[bluecmd]$ pwd
/home/bluecmd/go/src/github.com/u-root/u-bmc/pkg/bmc/ttime
[bluecmd]$ go get
# github.com/u-root/u-bmc/pkg/bmc/ttime
./roughtime.go:52:29: cannot use srv (type *"roughtime.googlesource.com/roughtime.git/go/config".Server) as type *"github.com/cloudflare/roughtime/vendor/roughtime.googlesource.com/roughtime.git/go/config".Server in argument to roughtime.Get
Using go1.11 FWIW.
Line in question is: https://github.com/u-root/u-bmc/blob/master/pkg/bmc/ttime/roughtime.go#L52
Huh, I just cloned your repo, added your changes, and go get-ed without issue. I'm also on go1.11:
Gabbis-Work-MacBook:ttime git diff
index b29e57c..0000000
diff --git a/pkg/bmc/ttime/roughtime.go b/pkg/bmc/ttime/roughtime.go
index fd2a462..b65e702 100644
--- a/pkg/bmc/ttime/roughtime.go
+++ b/pkg/bmc/ttime/roughtime.go
@@ -11,9 +11,9 @@ import (
"time"
"github.com/beevik/ntp"
- "github.com/u-root/u-bmc/pkg/roughtime"
- "github.com/u-root/u-bmc/pkg/roughtime/upstream/config"
+ "github.com/cloudflare/roughtime"
"golang.org/x/sync/errgroup"
+ "roughtime.googlesource.com/roughtime.git/go/config"
)
const (
Gabbis-Work-MacBook:ttime gabbifisher$ go get
roughtime.go:14:2: found packages roughtime (client.go) and ttime (vendor.go) in /Users/gabbifisher/go/src/github.com/cloudflare/roughtime
The way your repository is vendored, it looks like you have dep installed. Just in case, have you tried running dep init
in the u-root/u-bmc directory?
I disabled vendoring in my repository because another dependency doesn't work with vendoring.
Was the only thing you did a clean git clone and go get in that folder?
I'll try with a clean go src and get back to you. I appreciate the help here, I really do.
Yup! I did a clean git clone of u-root/u-bmc, applied your changes, and ran go get
. Let me know if that works for you!
Hello again. I removed my go/src/
and did go get github.com/u-root/u-bmc/pkg/bmc/ttime
. Same result for me again.
[bluecmd]$ find ~/go/src/ -maxdepth 2
/home/bluecmd/go/src/
/home/bluecmd/go/src/roughtime.googlesource.com
/home/bluecmd/go/src/roughtime.googlesource.com/roughtime.git
/home/bluecmd/go/src/github.com
/home/bluecmd/go/src/github.com/cloudflare
/home/bluecmd/go/src/github.com/u-root
/home/bluecmd/go/src/github.com/beevik
/home/bluecmd/go/src/golang.org
/home/bluecmd/go/src/golang.org/x
[bluecmd]$ git status --ignored [ttime] [02:02:27]
On branch master
Your branch is up to date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: roughtime.go
no changes added to commit (use "git add" and/or "git commit -a")
[bluecmd]$ pwd
/home/bluecmd/go/src/github.com/u-root/u-bmc/pkg/bmc/ttime
[bluecmd]$ go version
go version go1.11 linux/amd64
[bluecmd]$ go get
# github.com/u-root/u-bmc/pkg/bmc/ttime
./roughtime.go:52:29: cannot use srv (type *"roughtime.googlesource.com/roughtime.git/go/config".Server) as type *"github.com/cloudflare/roughtime/vendor/roughtime.googlesource.com/roughtime.git/go/config".Server in argument to roughtime.Get
I'm really scratching my head here that you're not seeing the same.
Edit:
[bluecmd]$ git diff
diff --git a/pkg/bmc/ttime/roughtime.go b/pkg/bmc/ttime/roughtime.go
index fd2a462..b65e702 100644
--- a/pkg/bmc/ttime/roughtime.go
+++ b/pkg/bmc/ttime/roughtime.go
@@ -11,9 +11,9 @@ import (
"time"
"github.com/beevik/ntp"
- "github.com/u-root/u-bmc/pkg/roughtime"
- "github.com/u-root/u-bmc/pkg/roughtime/upstream/config"
+ "github.com/cloudflare/roughtime"
"golang.org/x/sync/errgroup"
+ "roughtime.googlesource.com/roughtime.git/go/config"
)
const (
I think I know what's going on... So, the way golang vendoring works is that only dependencies from the root vendoring directories are included. So if you're trying to pull roughtime.googlesource.com/roughtime.git/go/config
from the vendor directory in the github.com/cloudflare/roughtime
repository, golang will not look for it in github.com/cloudflare/roughtime/vendor
.
Instead, golang will only look at u-bmc/vendor
to find the dependency. Because roughtime.googlesource.com/roughtime.git/go/config
is not in the u-bmc/vendor
directory, the go compiler will not find this package.
The way to fix this is to add roughtime.googlesource.com/roughtime.git/go/config
to your Gopkg.* to include it in your vendor directory.
Now, the reason my clone of u-root/u-bmc
worked is because I had github.com/cloudflare/roughtime
in my go/src
directory, so the go compiler on my computer found the package there.
I checked that my suggested fix worked. I deleted my local src/github.com/cloudflare/roughtime
directory and ran dep init
in u-root/u-bmc
. The google roughtime package was included in the root vendor directory, and go get
worked :)
Right, and that will work when I can use vendoring - but due to a bug in u-root which is a dependency of u-bmc, I cannot use vendoring. Besides, isn't it a quite weird dependency to require vendoring of your clients? :/
@gabbifish Ping! Did you see my question above? My experience is that having vendored dependencies in libraries cause these kind of issues snowballing the need to vendor.
Hi there! Apologies for the delay, I was out of town for a conference. Hmm, I think fixing vendoring in u-bmc is important and would definitely solve the problem, but another thing I can do is see if your use case of roughtime.googlesource.com/roughtime.git/go/config
is a feature we want to add to cloudflare/roughtime
. If so, this could allow you to drop the import roughtime.googlesource.com/roughtime.git/go/config
call and should fix the issue. I'll take a look into this.
Fwiw, the vendoring issue on my side is in a dependency of u-bmc, so that as well out of my control - they are working on fixing the issue, but unclear how long it will take. So I'm stuck between a rock and a hard place.
Hi,
I'm trying to use your server library, but running into vendoring issues.
You're expecting a
roughtime.googlesource.com/go/config.Server
as input to e.g.roughtime.Get
. When I'm trying to use it like this:With
roughtime.googlesource.com/go/config
in my vendor directory, I get this:Do you have any ideas on how to solve this?