4 ms·
> As I observe, Go projects are really messy. I saw some code importing code like "import github.com/foo/bar". That's not messy; that's idiomatic Go. By conven
by burntsushi 14y ago
> As I observe, Go projects are really messy. I saw some code importing code like "import github.com/foo/bar".
That's not messy; that's idiomatic Go. By convention, package imports can be URLs to version control repositories, which the `go` tool uses to determine dependencies and install them automatically.
Go has no equivalent `package.json` file. All package information is inferred from the source code.
The closest thing to a central repository is on the Go wiki. [1] Many people also use godoc.org [2], which is searchable.
[1] - https://code.google.com/p/go-wiki/wiki/Projects https://code.google.com/p/go-wiki/wiki/Projects
[2] - http://godoc.org/-/index http://godoc.org/-/index
- oakaz 14y ago> That's not messy; that's idiomatic Go Haha. Everybody understands Go has a tool that deals with dependencies for you. And any other language can have it. And this is why I avoid monopolistic platforms even though they are fast. If the owner of your platform has no taste of aesthetics, you'll write fast and ugly looking code. which is not fun for me. As PG says in his book, a good solution should also look good and simple. Go is very imperative, ugly looking, and not simple. > http://godoc.org/-/index http://godoc.org/-/index This link is actually a self-answer by you.
- drivebyacct2 14y agoYou clearly haven't a single clue what you're talking about. I've never, ever, ever heard someone describe Go this way: >Go is very imperative and ugly looking, and not simple. Further, this is just stupid: >And this is why I avoid monopolistic platforms even though they are fast. If you don't want to use `go`, so be it. The manual compiler and linker tools are available that you can cobble together with make or ant or whatever masochistic tool you prefer. >This link is actually a self-answer by you. What are you whining about? What do you want? That's just a laundry list of known/seen Go packages. As everyone else has already told you, there's no need for a package.json and this literally isn't a problem for anyone actually writing Go code.
- oakaz 14y agoCool down. Apparently you guys are having difficulty of discussing about negative sides of your language and platform and this is fair for an immature community.
- drivebyacct2 14y agoIt would be less "difficult" for "me" if you had a proper frame of reference. I have actually used Go to write real code and be productive with it.
- burntsushi 14y agoFrom what I can tell, the only negative thing you've said about Go in this thread is that "it's ugly." What kind of discussion were you hoping to have?
- burntsushi 14y ago> Go is [...] ugly looking, and not simple. I disagree.
- deleted 14y ago[deleted]
- evincarofautumn 14y ago> That’s not messy; that’s idiomatic Go. The two aren’t mutually exclusive. If that URL goes down, is there a fallback mechanism? For what it’s worth, I agree with oakaz’s sentiment that Go is “very imperative” and “not simple”. It is deliberately designed that way, with lots of syntax and types for representing (abstractly) the inherent complexities of its intended domain. Any ugliness, however, is purely subjective.
- burntsushi 14y ago> The two aren’t mutually exclusive. The OP (of this thread) said, 'I saw some code importing dependencies like "import github.com/foo/bar."' I did not understand this as a criticism of the design choice of using URLs as imports, but rather, a statement about some Go projects doing something horrendously wrong. Yes, one can think URLs as imports is both messy and idiomatic, but I do not feel that was central point of the OP. I suspect we will never get a clarification, though. > If that URL goes down, is there a fallback mechanism? I don't know what you mean. If the package is no longer available at the URL then it cannot be downloaded from that URL. > For what it’s worth, I agree with oakaz’s sentiment that Go is “very imperative” and “not simple”. It is deliberately designed that way, with lots of syntax and types for representing (abstractly) the inherent complexities of its intended domain. Go was not deliberately designed to be "not simple." In fact, it was deliberately designed to be simple. Simplicity's name is invoked again and again as a justification for including or not including changes to the language.
- ekanna 14y agoFirst you will use "go get github.com/foo/bar" This will install the package for you And then in your source code you will use "import github.com/foo/bar"
- skybrian 14y agoThe way it works is that you use "go install" to download your dependencies and then check them in locally. Adding a new library is like any other commit. Upgrading to the latest version is easy - just run "go install" and commit again.