Better HN
topnewbestaskshowjobs
Log inSign up

lobster_johnson

10,160 karma · joined Sep 9, 2010 (16y ago) · 3,638 submissions

Norwegian developer in NYC.

Email: hackernews@purefiction.net

Github: https://github.com/atombender

Submissions

comment 8y ago · link · parent

Good article about yield_self: https://zverok.github.io/blog/2018-01-24-yield_self.html

comment 8y ago · link · parent

Varnish uses GCC to compile VCL into a dynamically loaded library. Not a general-purpose language, but it's done at runtime.

comment 8y ago · link · parent

Thanks for the clarification. I saw the readme, and I assumed (wrongly) that each rule just receive a file name.

I wonder where you draw the line between a "linter aggregator" and a "linter". golangci-lint incorporates all the rules themselves, though it imports the linter logic as libraries, so I'm not sure that it's fair to call it an aggregator. Gometalinter runs linters as child processes and I don't think it contains any linter code, so it's a pure aggregator.

My point is that while your project is admirable, the Go world isn't large enough for so many linter projects. Personally, I just want one good linter that is maintained and that incorporates all the rules I want.

comment 8y ago · link · parent

Have you looked at golangci-linter [1] at all? It's a competing project that also implement a bunch of linter rules, and was created because gometalinter is too slow.

One reason golangci-linter is faster is that it shares the same in-memory representation of the linted packages between all the linters. From what I can tell, Revive requires that each rule parse the file itself, which is the same design gometalinter use, and it will absolutely kill performance for anything that needs to operate on the full AST.

Also, the Go community does not need a bunch of competing linter tools. For one, at means that tools like Visual Studio Code's Go plugin [2] will have to build special support for each linter tool. Gometalinter was nice because it built lots of rules (including golint) into a single tool, so you just needed that one tool.

I agree with the others about configuration. I think a lint tool should have a configuration work out of the box that reflects Go standards that everyone, without doubt, uses. More controversial conventions such as requiring all exported functions to have comments don't need to be included.

[1] https://github.com/golangci/golangci-lint

[2] https://github.com/Microsoft/vscode-go

comment 8y ago · link · parent

I've not used Berkshelf, but I suspect your problems were related to Chef and the fact that they've built their own dependency system that also interacts with Bundler/RubyGems.

Anecdotally, my company has used Ruby since around 2004, and Bundler since its first release, and we never had any issues. That doesn't mean nobody has ever had any issues (clearly! [2]), but it generally seems like Ruby package management is a solved problem, and that it would be a good model for any dependency system to use.

Bundler does have one feature (or misfeature) that Russ Cox criticizes: "bundle install some_gem" can cause unrelated gems' minor (or maybe it's minor) versions to be upgraded even if you don't tell it to. I've never liked that, and would much prefer to use "bundler update" to perform explicit upgrades. But I don't think that behaviour is at all tied to its solver, or that MVS is needed to fix it.

[1] https://github.com/bundler/bundler/issues/5068

[2] https://github.com/bundler/bundler/issues

comment 8y ago · link · parent

Thanks for the explanation!

The fact that dep parses import statements (as does Glide) is something I've never liked. It means that if you run "dep ensure --add" on something not yet imported, it will complain, and the next "ensure" will remove it. This is never in line with how I actually work. I need the dependencies before I can import them! There's no editor/IDE in existence that lets you autocomplete libraries that haven't been installed yet.

It also means that "dep ensure" parses my code to discover things not yet added to Gopkg.toml. That's upside down to me. I want it to parse its lockfile and nothing else; the lockfile is what should inform its decisions about what to install so that my code works, my code shouldn't be driving the lockfile! If I try to compile my code and it imports stuff that isn't in the lockfile, it should fail, and dep shouldn't try to "repair" itself with stuff that I didn't list as an explicit dependency.

I'm sure there are edge cases where the current behaviour can be considered rational, but I don't know what they are. As you point out, dep has to do a lot of work -- but why? Running "dep ensure" when the vendor directory is in perfect sync with the lockfile should take no time at all, and certainly shouldn't need to access the network. Yet it takes the same amount of time with or without a lockfile.

comment 8y ago · link · parent

> Now Cox's solution might indeed be better (though I think it's an overkill ...

vgo is actually much, much simpler than dep. The sheer number of words in Russ Cox's series of blog posts belies its simplicity. vgo doesn't need a SAT solver. If you look at many of the issues dep is struggling with, they're related to solving N libraries with transitive dependencies up the wazoo.

Cox's long treatise reflects the complexity of the problem space. Developers tend to brush off package management as being simple. But once you include range-based version constraints and transitive dependencies, it gets a bit messier. Look at NPM and Yarn; they're still struggling to get all the details right. On the other hand, there's Ruby's Bundler. It came out in 2009, RubyGems in 2004, and I've never had a single issue with the toolchain (other than messing up my own constraints). I don't know what kind of magic elixir they were drinking, but somehow those guys managed to nail it from day one.

comment 8y ago · link · parent

Testing and package management aren't mutually exclusive. If you're in a monorepo, all your code evolves in lockstep. A core tenet of versioned package management is to get reproducible builds that only need to break once you choose to evolve forward in time (i.e. upgrade).

Historically, most languages (C, C++, pre-Maven Java) haven't had package management at all, and so dependencies have typically been managed by vendoring the code (or JAR files). JAR files worked okay, but vendoring incurs maintenance overhead that isn't acceptable in today's environment. git submodules are theoretically a solution, but also high-maintenance.

comment 8y ago · link · parent

Here [1] is the "dep ensure -v" output for a project of mine. It takes almost 12 seconds even when there are no changes to the actual file. I don't know why, or whether it's actually the solver (though the output seems to indicate it).

[1] https://gist.github.com/atombender/7c28f1d371fcb139e1e742a08...

comment 8y ago · link · parent

Every Go project I've used uses git tags prefixed with "v", e.g. v1.0.3.

https://github.com/gogo/protobuf

https://github.com/olivere/elastic

https://github.com/golang/protobuf

https://github.com/sanity-io/litter

comment 8y ago · link · parent

Nothing yet. The new tools should land in 1.11, but will be an experimental opt-in, with the aim of full support in 1.12.

comment 8y ago · link · parent

Cox discusses Cargo here, and why he doesn't like it: https://research.swtch.com/vgo-repro

comment 8y ago · link · parent

The vgo proposal explicitly rejects the "Cargo way" [1]. There's no lock file, and the MVS algorithm requires, as far as I recall, that the go.mod file is modified whenever the developer wants to update to a new version.

[1] https://research.swtch.com/vgo-repro

comment 8y ago · link · parent

Rust/Cargo had the luxury of being a greenfield project that could adopt semver from the beginning, whereas Go made the mistake of starting out, and then going years, without any official package management solution. As a result, Go has a swathe of applications and libraries that use specific workflows as well as a mélange of community-developed package management tools such as godep, Glide and dep. The semver standard, in particular, has been inconsistently adopted by the Go community.

In other words, any new Go tool either has to support/import existing code, or to wipe the slate clean and say that for a package to be importable it has to follow a new spec. dep decided on the former, and my impression is that this has had unfortunate consequences, because that inherits a lot of historical baggage.

We've been using dep for a while (having escaped the bugfest that is Glide, which used a very similar approach), and it's pretty evident that the solver is buggy and slow and also complicated enough that fixing issues like [1] can only be done by a select few that already understand the codebase. I'm not in a position to judge what the causes of all of these issues are, though I'd wager they're not entirely unrelated to the inherent complexity of SAT solving. The current dep issue tracker is full [2] of reports mentioning the solver, not to mention that dep currently has problems with known libraries such as the Kubernetes client [3] and Protobuf. (Google-related projects have historically used godep.) Again, possibly related to this specific implementation and not necessarily something that would apply to a hypothetical "Cargo for Go", but I don't know.

Any idea how Cargo compares to dep overall?

[1] https://github.com/golang/dep/issues/1306 — this one is a nightmare if you work anything related to Kubernetes.

[2] https://github.com/golang/dep/issues?q=is%3Aissue+is%3Aopen+...

[3] https://github.com/golang/dep/issues/1207

comment 8y ago · link · parent

You missed my point; I didn't say it's new, I said it was simpler than it might seem, and that thinking of it as a state machine makes it easier to understand what the core of Kubernetes really is.

And of course "nothing but a pattern" is nonsense. Pre-container systems like Puppet and Chef -- which are also, vaguely, based on converging real state towards desired state -- are firmly rooted in the traditional Unix model of mutable boxes. You can't implement a consistent reconciliation loop if your state can't be cleanly encapsulated (as with containers).

comment 8y ago · link · parent

Google uses Borg internally, and Kubernetes is really their third container orchestration system. After Borg came Omega, which was never deployed, but ended up being a test bed for a lot of innovations that were folded back into Borg. But Borg is a decade old and has a lot of warts (according to its designers), and with Kubernetes they aimed to learn from their mistakes and improve on the design.

As far as I can tell, the aim with Kubernetes was never to replace Borg at Google -- Google is far too invested in Borg, and it would take a considerable engineering effort to migrate away from it. Rather, developers at Google saw an opportunity to create an open source version based on what they had learned and help the world along in adopting the same engineering principles as Google has long practiced. Not all altruistic notions, of course -- Google benefits from the commoditization of containers indirectly, by undermining competitors such as AWS (where containers are still not well-supported) and making their own cloud the best fit for Kubernetes.

Google does run stuff on Kubernetes, via GKE. As I understand it, new products are encouraged to run on GCP. I don't know how many applications they run, however. Maybe someone from Google can comment.

comment 8y ago · link · parent

I would also argue that Kubernetes is less complex than it seems at first glance.

Yes, if you look at all the possible parts, and at the current monolithic codebase, there's a lot of complexity. It also supports umpteen cloud providers, volume providers, networking stacks, etc., and comes with a whole swathe of bootstrapping tools for various environments (e.g. AWS).

But if you strip it down, Kubernetes is "simple": There's a consistent object store made out of JSON structures, and then there's a bunch of controllers listening to changes to that store to make stuff real. That is the core. Everything is, in principle, controllers mediating between the data model and the real world. Very elegant and orthogonal.

You also have an API, a scheduler, and a thing called Kubelet that runs on each node to manage containers and report node-specific metrics. And of course you have Docker, though with 1.10 you can more easily run dockerless via containerd, which is a great thing indeed.

The complexity comes from the operational part, when the pieces come together. And as you say, there's not really any way around it.

comment 8y ago · link · parent

Disagree. OpenShift and CNCF are arguably exactly that, but Kubernetes itself isn't. It came out of the engineering team at Google, and its technical merit shouldn't be confused with the considerable marketing effort being put behind it.

Docker Swarm is much more deserving of this kind of cynicism -- a weak, badly designed solution forced on users by a company that's realizing their invention has been commoditized and is no longer a platform they control. Swarm was redesigned at one point to work more like Kubernetes because they realized it was a much saner model.

Kubernetes has more complexity, but it does scale down to single-node clusters.

comment 8y ago · link · parent

Wonderful novel, though. The book is by the great Friedrich Dürrenmatt, and is basically a deconstruction, as well as a subversion, of the detective novel (in fact, its subtitle is "Requiem for the Detective Novel").

comment 8y ago · link · parent

J and K are extremely terse, though. They just chose other ASCII symbols that exist on everyone's keyboard.

comment 8y ago · link · parent

I meant neuter! I studied German for three years in school, but my brain got its wires crossed there for a second.

comment 8y ago · link · parent

At this point gender in most languages has almost nothing to do with the semantic meaning of the words themselves -- biological gender or whatever -- and we might as well call it something less culturally loaded like "noun class". A famous example is "das Mädchen" in German -- a masculine (edit: neuter, I mean!) noun for a biologically feminine person. Languages are littered with such inconsistencies, and as a language learner almost all of the genders are not discoverable from the semantic meaning of the word. Why is "ei bok" (Norwegian for "a book") feminine, when it's categorically an inanimate thing?

comment 8y ago · link · parent

Sure, it might work. A binary format still has to be parsed, of course, but it would likely be a little more efficient.

One question is whether that efficiency gain would be worth the hassle of a binary format. Binary formats have generally not been a good fit for the web; DNS and HTTP/2 are the only widespread protocols I can remember off the top of my head that are binary. gRPC is binary, and look at the lack of mature toolchains to work with it -- while there are some tools now, the selection is minuscule compared to those available for HTML and CSS.

Binary formats are also trickier to extend and keep backwards-compatible.

comment 8y ago · link · parent

As someone who uses Go daily and enjoys it a lot, there's definitely an inflection point in many areas where Go's lack of abstraction becomes a pain point.

One application I work on is a real-time query engine. Queries are parsed into ASTs, then reorganized into a higher-level graph reminiscent of relational algebra, then run through optimization stages, etc. Go is terrible at this in pretty much exactly the same way C is. Clearly, good software has been written in C that face the same challenges; PostgreSQL comes to mind, but I've read the PostgreSQL code, and while it's clean, I don't find it that readable or nice. Those guys work with C's limitations, of course, and that's fine.

One specific example here is matching structures. I look at Haskell and Scala with envy, because you can do things like this (pseudocode!):

    match expr {
      Or(p, And(q, r)) => And(Or(p, q), Or(p, r))
    }
Similarly, writing graph-traversal (walking and transformation) logic in Go is painful. Go doesn't have sum types, so you have to dick around with interfaces (which weren't meant for this) and write big table-driven tests to ensure that all your matching cases is exhaustive.

There's a lot of boilerplate, and there are times where I've been tempted to write code generators that use small DSLs that let me express everything in a higher-level way. But I've not taken that step yet.

If I'd started this particular project today, the choice would have been Rust or C++. This applies to future project that smell like something that'd need this kind of expressiveness.

Another area where Go disappoints is how surprisingly hard it is to write good concurrent programs that need to distribute work and handle errors in a resilient manner. Your actual logic — the meat of your program — quickly becomes obscured by error handling, ErrGroups, channel orchestration, inelegant wrapper structs, managing the lifecycle of resources (sockets and files and what not) and, ugh, contexts. Context is like a virus that morphs code into refactoring monsters every time you start weaving it through your application. I get Erlang envy when I need to do even the simplest thing, like coordinate the concurrent importing of chunks of data that is distributed to a dynamically growing/shrinking pool of worker goroutines. With all the bragging about modern CSP, Go provides nothing that can compete with Erlang supervisors, which is mightily strange for a (relatively speaking) new language supposedly invented for writing resilient networked systems.

comment 8y ago · link · parent

I've been waiting for something like this! Gometalinter is notoriously inefficient, and it's always bothered me that it runs every linter separately as opposed to parsing the code once and then running analysis on it. There's really no need to spread lint logic around in dozens of little projects when a single, monolithic linter (with modular rules) would be much easier to make performant. This project looks exactly like what's needed.

The only negative is the name -- I understand the desire to market your hosted linting product, but "golangci-lint" is hard to remember and something of a mouthful.

comment 8y ago · link · parent

There are several factors. Technical brilliance is one, but Kubernetes is of course not entirely alone there; DC/OS (which is what you usually would be talking about these days if you're saying "Mesos", since Mesos is just a scheduler and doesn't in itself provide most of the features you need) is also highly regarded. Swarm is not highly regarded, and often disparaged as an inferior imitator.

Another big reason is better marketing and evangelism. Kubernetes has a lot of companies betting on it and who are actively promoting it. It has the CNCF (Cloud Native Computing Foundation) [1], a suborganization of the Linux Foundation. While CNCF also includes Mesos, it was initially, I'm told, invented as a way to move Kubernetes out of Google, thereby commoditizing and democratizing it as an open-source ecosystem; Kubernetes was the first CNCF project.

It's a savvy move on Google's part. It's reminiscent of Sun's "standardizing" of J2EE, JMS, etc. back in the day, which in itself spawned a whole cottage industry of enterprise software and certifications. CNCF/Linux Foundation, of course, offer certifications, as well as events (KubeCon) and training programs, all of which involve marketing and evangelism.

So there's a whole engine behind Kubernetes which make the competitors (of which we have Hashicorp Nomad, DC/OS, Amazon ECS and to some extent CoreOS (at least their original cluster design) and Rancher) seem like children's lemonade stands by comparison.

But even with all of this momentum, none of this would work very well if Kubernetes weren't popular with developers and sysadmins. Kubernetes has been enthusiastically embraced for its excellent design, and so there's little pushback from below; when devs tell management they should be betting on Kubernetes, it's easy for them to say yes, but the opposite is also true. And since Kubernetes also works to commoditize containers, it ends up being one of those rare projects that appeal equally to developers, sysadmins and suits. The pointy-haired bosses at IBM and other big corporations realize they can leverage the platform for their own enterprise offerings.

So you could say that Kubernetes scales all the way down to the individual developers, and also all the way up to the highest levels of big corporations. It's the Linux of container orchestration.

[1] https://www.cncf.io/

comment 8y ago · link · parent

I don't see it mentioned in the GKE release notes, so I assume there's no option to enable it yet.

comment 8y ago · link · parent

This is great. Anyone know what Google's plans are when it comes to rolling this out on GKE?

comment 8y ago · link · parent

> their databases resemble vomitoriums

Curious what you mean by this. Vomitoriums had nothing to do with vomit, except in an etymological sense.

comment 8y ago · link · parent

Some good, fairly recent data from Pew [1] and in this [2] NY Times article. From what I gather from this, border crossings are going down, but illegal visa overstays are going up.

[1] http://www.pewresearch.org/fact-tank/2017/04/27/5-facts-abou...

[2] https://www.nytimes.com/interactive/2017/03/06/us/politics/u...

12345
122