-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Doesn't support GOPATH with multiple directories #78
Comments
$ bud version
bud: 0.1.4
svelte: 3.47.0
react: 18.0.0 |
Sorry for the trouble @TechWilk! Let me look into it. It's odd because it appears like you don't have the runtime installed. This should have happened when you ran Two questions if you're around:
|
Okay, so I just ran the steps you outlined and it's working correctly for me. However, if I manually delete the runtime:
I'll get the same error you're seeing:
I can't really explain why you don't have the runtime installed since it should do that automatically for you with One thing that's odd in your error:
Any idea why there's a colon? Can you confirm that the following directory exists? |
Thanks for your quick response!
echo $GOPATH
/home/user/go:/home/user/code/go Ah ok, so that reminds me... the first time I was playing with Go the getting started guide I used recommended splitting the GOPATH so that your own projects lived in a separate dir to all the imported modules. e.g. you work in I think I've sussed the issue then, it's that bud doesn't support GOPATH with multiple directories. $ ls /home/user/code/go/pkg/mod/github.com/livebud/[email protected]
ls: cannot access '/home/user/code/go/pkg/mod/github.com/livebud/[email protected]': No such file or directory
$ ls /home/user/go/pkg/mod/github.com/livebud/[email protected]
Changelog.md go.sum livebud package.json scripts
Contributing.md install.sh main.go package-lock.json tools.go
docs internal Makefile Readme.md version.txt
go.mod License.md package runtime |
Woah, I had no idea this was possible! I guess it makes sense, I'm pretty sure this is the problem! I'll try and come up with a solution. In the meantime, does the following work for you? GOPATH=/home/user/go bud run One more thing, you do remember which getting started guide you used that recommended this? I'd like to learn more. |
Yes as far as I know that's correct. There's a bunch of stuff in there $ ls -l /home/user/go/pkg/mod/ | wc -l
16 Thanks! I don't remember which guide off the top of my head. I'll try and dig it out for you. |
It's a bit old, but here is a a SO post that has some good links about multiple GOPATHs and why you'd use them. I'm also really interested in this issue, so I'm currently researching solutions |
@matthewmueller I think I might have found a solution, but it seems there are different solutions for Go1.17 and Go1.18. I think that the 1.17 solution will work with 1.18, but I'm not 100% certain. I'm running 1.18 locally, though, so I can test that out |
Awesome, I also got some feedback from the Go community on Twitter:
This makes total sense to me pre-modules, where you want to keep your maintained projects in a clean directory away from your downloaded modules. Nowadays, go modules are tucked away in @syke99 what are you encountering that leads you to believe there's different solutions for 1.17 and 1.18? At first glance, I was thinking this would be a fairly simple solution, split on |
Yeah, I was going to mention that it seems to be a bit outdated of a practice. In the end, yeah, I was going to just recurse into all directories listed, after separating out each path into its own substring. But what I found that leads me to believe the solution would be different is how you go about getting the GOPATH in 1.17 vs 1.18. 1.17: 1.18: after closer examination, you can still use source: the first answer in this SO post |
I'm pretty sure I'd suggest we use that unless there's good reason not to and then:
|
Right, that makes a lot of sense. I must have been following a pre-modules guide. (bonus, I've now learned about modules!)
According to one of the answers on @syke99's SO link it's worth noting that the delimiter in $GOPATH is OS-specific, so just splitting on $ go help gopath
The Go path is used to resolve import statements.
It is implemented by and documented in the go/build package.
The GOPATH environment variable lists places to look for Go code.
On Unix, the value is a colon-separated string.
On Windows, the value is a semicolon-separated string.
On Plan 9, the value is a list.
... |
Thanks for the heads up! I always wondered what os.PathListSeparator was good for 😄 |
Ahh yeah, I forgot to mention that. Thanks @TechWilk!! depending on how you want to implement a fix, you could simply run a check for the value of the env variable GOOS like so:
|
os.PathListSeparator does this already. Let's lean into Go's standard libraries as much as we can. This will help us on the path to cross-platform compatibility. |
Ope, yep. I must’ve missed your comment about os.PathListSeparator and didn’t know it was part of the std lib. I definitely agree to use it!! |
Hi folks, I was planning to try bud but I ran into similar issues as mentioned in this thread. My setup:
|
Hey @edimoldovan, that's weird. Can you share your It seems like the runtime wasn't downloaded. What commands did you run before you reach this error? Can you try go get -u github.com/livebud/bud |
I've just been attempting to try out bud, but ran into issues before I could get going.
Granted, I've not got far into learning Go, I thought bud would help to give me a gentler start to creating a web app, so I may be missing something that is considered "basic Go knowledge".
I've followed your example to get going:
and I get presented with the following:
I've previously had Go 1.17, but upgraded to 1.18.2 which didn't change anything.
The text was updated successfully, but these errors were encountered: