-
Notifications
You must be signed in to change notification settings - Fork 150
Compatibility with tools at golang.org/x/tools #42
Comments
That's a good question. For most you should be able to emulate GOPATH with
For example. This is also what the plugin interface is for, On Tue, May 5, 2015 at 3:51 AM, Nicolas Grilly notifications@github.com
|
Hello Dave, To be frank, this is the answer I expected, and this is honestly a good solution. :-) But, as we are there, why not do the same for |
I think the fact that Technically there is nothing that Why is this? Well probably for one, Go programmers want to use tools written in Go. This seems like a bizarre statement, but it's true, not just for Go programmers, but pretty much most programming communities. Ansible exists because Python programmers didn't want to manage their servers with Ruby. The second reason is, while you can construct an equivalent line of shell to what gb does, generalising that with Basically, any solution to this problem will be a. written in Go I think there is also value in convention. I chose So, what does gb do ? Nothing that you couldn't do by hand. But people don't want to do things by hand, they want someone else to do it for them; hence |
Dependency management in Go is a problem. It's inconsistent and cumbersome. There are competing tools and processes all of which sort of work. I like Yes everything (at the moment) that |
I understand that As an aside, I'm a user of Ansible since a long time (and even a minor contributor), and I doubt its success is related to Python programmers wanting to use devops tools written in Python. I'd say Ansible is successful because of its learning curve (it's a lot simpler than Chef and Puppet), its YAML recipes, and using SSH instead of dedicated agents and servers. I'm happy that Ansible is written in Python, but I would have chosen it over Chef and Puppet even if it was written in Ruby ;-) |
@Supermighty, I agree that dependency management is still a problem in Go. But it's probably more a problem for newcomers, lost in the sea of existing solutions, than for experienced Go developers, that can easily use one GOPATH per project (like Digital Ocean [1]) or import path rewriting (like godeps, nuts or kardianos/vendor). And I'd say that even in languages like Python, Ruby, Node or Java which have established dependency management solutions, it's not all roses, and these tools come with their own set of problems and limitations. I agree that But I'm worried about the scope of Again, I really appreciate the effort, but we need to think forward before risking to "fragment" the community for a small benefit in return. In your comment, you complained there are many competing dependency management tools and processes. It would be worse to have several competing build systems and processes. [1] https://www.digitalocean.com/company/blog/taming-your-go-dependencies/ |
Nicholas, forgive my bluntness, but you are arguing to not do something Obviously I don't share your concerns and feel the task is achievable. Even if gb is not a success, the idea of standardising on a project layout On Tue, 5 May 2015 06:17 Nicolas Grilly notifications@github.com wrote:
|
I reread my comment and I don't think this is what I've been arguing. I'm not arguing "to not do it because it's hard". I'm arguing about making sure the resources dedicated to I'm not arguing "to not do it because it won't work out". I'm arguing about making sure to not create more confusion about the issues of managing its GOPATH and managing dependencies. One of the stated goal is to simplify the life of Go developers by not having to setup the GOPATH manually to build a project. I concur with that. But the truth is that Go developers use many other tools (goimports, godoc, oracle, gorename, etc.) and they have to setup their GOPATH anyway. I'm just wondering what have we gained? To be very clear, I'm not against the idea of |
I must apologise for the tone of my previous remarks. However I would like to correct some misunderstandings
I'm dedicating my time to making I guess the question of is
@nathany compiled a list of several dozen competing tools, and this was over a year ago, the field is even more crowded since then. I'm afraid that I don't see how me writing another tool could make things any more confusing than they already are.
You are correct that today none of those tools work with gb projects, because up until a few weeks ago, none of those tools were aware of gb projects. Given how similar a gb project is to a multi element $GOPATH, something those tools have to already support, if gb were to gain sufficient market traction, adding support for gb projects to those tools is trivial (I say, knowing that I may be signing someone else up to do the work). In summary, the concern that those tools don't understand a gb path is valid, but certainly not a showstopper in my opinion. In summation. You've asked in several threads why I chose to write a new tool. The best answer I can give is because none of the others had achieved significant market share. I hope, by trying something different, by not just wrapping the go tool and working within the structure of $GOPATH, gb will achieve more success. |
My reason is that a shell script is less portable than Go code. When I investigate a proposed solution to this problem and I see the phrase "shell script" I just stop and move on. My use case requires building binaries for a heterogeneous environment (Windows & Linux). Hence the capability to cross compile or compile on multiple platforms or do both, using a single build tool and a single project repo, interests me far more than a platform specific script. |
I'm going to ask what's perhaps a stupid question, but which I think paraphrases what @ngrilly is saying. What if
So one could do If this whole problem boils down to managing I think the only exception is that |
@tsuna it's certainly not a stupid question. The reason gb does not wrap the go tool is two fold a. divorcing itself from the go tool gives gb a clean slate to work from, not to be bound to simple orchestrate the movements of the go tool. There is a fair point to be made that in #50 I made the decision to retain some compatibility with source arranged in the traditional GOPATH layout, but this was for compatibility with tools like goimports, godoc, golint, etc which work with GOPATH. It was not for compatibility with the go tool itself. b. Personally I don't see any value in a tool that wraps the go tool. Others have tried, most notably godep (without -r), and it received little mindshare. I'm going to go to the extreme of saying I felt that Go developers do not want another wrapper, they want an opinionated tool. |
I wonder if we could have achieved the solution to the core issue (fix the vendoring problem and get mindshare while at it) in a "opinionated" way without having to potentially fragment the Go community around the usage of the Go tool. @tsuna has made a very valid argument about how much of what we are trying to achieve can also be achieved without having to reinvent the wheel. While no one is doubting your (as in @davecheney) commitment to the project and what you have done for the Go community thus far, I am a bit worried about effort being spent towards the wrong thing. So the questions which come to my mind are:
Also, I would say that https://github.com/tools/godep has significant mindshare. Almost every big Go project (docker, kubernetes come to mind) use it in almost exactly the same way as gb (except for the name of the actual vendoring folder). |
No, I do not believe so.
My philosophy is go get has artificially constrained the solution space for solving the go dependency management problem. You can wrap other tools around go get and go build to work around this, but like I say, they are workarounds and continue to live within the limitations of the go tool. None of these approaches that wrap the go tool have been successful, even godeps, which you mentioned has abandoned it's wrapping (godeps go build) in favor of vendoring code via rewrites. I do not believe another tool that wraps the go tool would have an appreciable impact on the market, so it's time for something more radical. |
@kidoman if this is your way of asking "why didn't you work with the go team to change the go tool?", I'll remind you that the Go team have chosen vendoring via import rewriting. I have spelled out in my presentation why I am not in favor of this approach, so there is no common ground to be had here. |
Side note: While godeps might be heading towards the rewriting approach, most of the projects are still using it w/o rewriting their dependencies. See: https://github.com/GoogleCloudPlatform/kubernetes/blob/master/Godeps/_workspace/src/golang.org/x/net/context/context.go On topic: I feel that we are conflating a few slightly unrelated things:
Let's assume for a moment (as it is a separate discussion) that (a) is a fact. Now, what you are saying is: (c) -> (b) (-> = implies) This is something I am not able to agree with. I believe this is what should happen: (e) + (c) + (d) + (g) -> (f) I love that you are tackling this problem head on, and you are on the right track when it comes to the eventual "vendoring" approach, but I do not see the connection between (c) (wrapping the Go tool) and (b) (not gaining market share). If you were to write a tool which brings out a opinionated approach to vendoring w/o disrupting the currently established go build process, the tool would gain market share purely because of (e), (g) and (a) (irrespective of whether it does (d) or not). And that would not have the side effect of fragmenting the Go community and leading to a lot of bikeshedding (I can foresee a lot of discussions in teams as they start out on a Go project about whether to pick a vendoring tool which uses the standard Go build tool or to pick a tool which replaces the standard Go build pipeline). Would having two competing Go build tools help the Go community? The jury is out on that one. |
@kidoman you wrote a lot, so forgive me for not writing a lot in return. Here is the shortest answer to all your questions I wrote gb because I did not feel that another tool wrapping the go tool would have enough impact to justify the effort put into it, and ultimately would be unsuccessful in actually fixing the problem of reproducible builds that I had. People who agree with my approach will use gb, people who wont, will not use gb. That's all there is to it.
Competition is good for consumers. |
What does I guess I'm still failing to see what's fundamentally different about I just re-read the slides of your talk and my understanding on your take is:
Isn't the above achievable using all existing tools simply by setting I could do |
@tsuna what you have described it Keith Rarick's godep, used without the -r flag to save. gb is an alternative to that that does not involve wrapping the go tool and goes not use GOPATH. It does this to make project owners decide how they want to manage the dependencies of their project. They will have to choose one of these options: a. use vendoring via import rewriting as proposed by the Go team It is worth noting that, prior to gb, project owners only have choices a and b. |
From this I infer you are preparing the ground for behavioural changes and don't want to be tied to the limitations that being just a go build wrapper would bring. Do you have anything specific in mind ?
I might try to give it a stab. However, what would be an acceptable way for e.g. goimports to detect that it's running inside a My editor invokes I know that it has been decided to go on with no configuration file, so we cannot rely on the presence of a .gb file or something like that. The reliability of the test might be crucial for making the support land in the official goimport (and friends). |
The major, and only change is a move away from $GOPATH, to the project structure described elsewhere. This is change enough, I only want to boil one ocean at a time.
I've proposed we do this as a gb plugin, see #61
I'm afraid I have no solution for you at the moment. However gb is backwards compatible with $GOPATH workspaces, because it fulfils the project autodetction rules, see #53. gb treats $GOPATH as one giant project with no vendored code.
No, see #53 for an explanation on how to detect a gb project. |
How do you feel about including a bin directory in the project root to setup the environment for golang.org/x/tools compatibility, similar to Python virtualenv's activate/deactivate? This could be done by gb-init. Or should this be left as an exercise for the end user? |
I'm not a fan of this style of workflow; http://go-talks.appspot.com/github.com/davecheney/presentations/reproducible-builds.slide#18 I think we can do better via plugins. |
How do you suggest existing plugins that use go tooling like vim-go adapt to this proposed change? My suggestion above is mostly concerned with code already written that assumes a specific environment. |
It's simple to write a gb plugin that constructs a GOPATH from a gb project and calls out to the tool. https://github.com/constabulary/gb/blob/gb-goimports/cmd/gb-goimports/main.go It's crude, but it works, and can be improved later on. |
Agreed, but unless I am missing something Vim script would have to be written to call gb instead of go for vim-go to be fully functional in a gb project environment. I imagine there other other IDE plugins that are also programmed to call go tools on certain triggers. |
@kevinjos vim-go support is already started, though @fatih may split it out a separate vim-gb plugin. fatih/vim-go@4262864 |
Why did you choose to have |
@nathany That's great, thanks for sharing. |
@kevinjos Here is the PR fatih/vim-go#420 with |
Some other clarification, I'm working on adding support for I've laid out the code, so it also supports There are only some problems I have in my mind, basically what to do if something has a
Assuming |
No good reason, we're still figuring out how to write plugins. |
I'm going to mark this as closed (answered). If you want to continue the discussion, please consider opening a new issue. |
I understand that
gb
tries to replacego build
andgo test
and replace or avoidgo get
. But what about the other tools at golang.org/x/tools? godoc, oracle, goimports, callgraph, eg, gomvpkg, gorename, etc. can be very useful and rely on a GOPATH being set. Thanks!The text was updated successfully, but these errors were encountered: