Live data from Hacker News

Go run

breadchris.com

51–60 of 173 posts

Re: Go run

#51
post #47

You can build the equivalent simple c++ program by just calling `make` with no arguments. Though TBF then you have to type ./a.out, and so then you want to do `make && ./a.out` and then...

>so then you want to do `make && ./a.out` and then...

Shell scripts ...

Re: Go run

#53
post #6

I don't think it's simple. Just `go run` would be far more simple. Right now I first have to figure out if its `go run .` or `go run cmd/main.go` or some other thing.

You also have to know whether it's `cd cmd; go run main.go` or just `go run cmd/main.go`. And you have to know to set CGO_ENABLED=0 if you want to run it on Linux instead of MacOS.

Re: Go run

#54
post #6

I don't think it's simple. Just `go run` would be far more simple. Right now I first have to figure out if its `go run .` or `go run cmd/main.go` or some other thing.

Or, even better, `./main`

That's not better but confusing as the "main" binary doesn't exist (The main point of go run), and you'd always have to type the full name as you can't autocomplete it.

Re: Go run

#55
> One of the understated features go run is that it will automatically download any dependencies the code references; how cool is that!

All this plus talk about non-standard JS runtimes like Node, but no mention that this is how browsers have worked almost forever.

Re: Go run

#56
Yeah, IMO, `go run` is a really under-appreciated part of what makes Go productive and low-friction.

That, and the ability to cross-compile without installing a cross-toolchain for the target platform. Having spent an inordinate amount of time writing build systems and compiling/distributing cross-toolchains, this is a _huge_ deal.

Re: Go run

#57
post #4

For TypeScript, "deno run" seems much the same? (It's only a subset of the JavaScript ecosystem, but you can import a lot of npms nowadays.)

And npx tsx index.ts for TypeScript, which supports ESM (although it does pull tsx)

Re: Go run

#58
post #32

Tangentially related: I am currently scoping out an idea for how language models could be used to augment decompilers like Ghidra. At a surface level, this was partially an intellectually interesting project because it is similar to a language translation project, however instead of parallel sentence pairs, I will probably probably be creating a parallel corpus of "decompiled" C code which will have to be aligned to…

an interesting project. go contains many source artifacts which make decompilation a bit more straight forward as well. I havent seen anyone really attempt this for go, but would be notable research

If it turns out that its easier for a language model to translate "Ghidra C" into readable Go code than to deal with CMake/Bazel/GNU autoconf/Ninja/Apache Meson/etc I wonder if that says more about the language model or the state of C/C++ toolchains...

Re: Go run

#59
> what happens if you want to use modern syntax like esmodule, or maybe you want to use types with typescript? You are going to have to use npm.

Shout out out to Bun (and Deno too?) for allowing you to treat typescript as an interpreted language. Great for scripting with all the bells and whistles.

(Go is great, just pointing out that running TS does not actually require NPM anymore)

Re: Go run

#60

Earlier quoted context omitted.

This is a good tip! It also captures what has been frustrating about golang for me. The language feels a bit stuck between simple default cases and allowing complexity. I feel like there are two relatively distinct populations of go developer: those who love how easy it is to start (true!) and those who are frustrated by the compromises the language has made to allow for more complex cases (required!). There's also a…

I don't get it. The default case is simple (go run .), and the complex case (specifying the relevant .go files one by one) is a little bit more complex. What's frustrating with that?

It's not this specifically - it's when this "kind of thing" comes up in golang in particular. Every language needs to pick when to hold back complexity and when to make the user deal with it and I just personally dislike golang's particular balance. I also respect the work! It just irritates me.
Post reply on HN