Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
NickPlowswell
Sep 14, 2014

The exoplanet has failed :qq:

good jovi posted:

Are you using any of the 3rd party dependency management tools? Or checking in your entire GOPATH?

It's a little frustrating that One True Way hasn't emerged yet, and I'm just not doing enough go development to be able to judge the competitors.

I don't really see how using go get doesn't satisfy people. If I recall correctly one of Go's goals is to make everything backwards compatible and it is adapted by pretty much all major packages.

I'm actually really glad that there aren't such ridiculous things like the depreciation mechanics Java has that are so blatantly ignored by most of it's users.

Adbot
ADBOT LOVES YOU

NickPlowswell
Sep 14, 2014

The exoplanet has failed :qq:

Azazel posted:

When you start importing a handful of 3rd party libraries and share those libraries among multiple developers/projects "go get" alone becomes very unsatisfying.

See, I always thought people were more worried about not having proper versioning though this does make sense.

NickPlowswell
Sep 14, 2014

The exoplanet has failed :qq:

Urit posted:

Is there a consensus on the most viable embedded scripting language for Go? I'm writing something that I'd like to allow (friendly - as in written by internal users and stored on disk with the program) arbitrary code execution in. Lua seems to be vaguely incompatible with Go on Windows due to longjmps for error handling which causes straight up crashes, plus it's playing with CGo. Otto looks neat but it's Javascript which no one wants to write, and it's not really fast for string processing. I found a random project on Github called Agora but it hasn't been maintained for a year and it's somone's toy scripting language, though it looks pretty neat.

There's
go-lua Which is all native Go so no cgo BS
otto V8 JS all in native Go.

I've used both of them with great success. Pretty decent in terms of performance for what it is, as well.

Pretty much everything else is trash/a toy language that you shouldn't expect users to learn or uses cgo

e: If it matters, I prefer otto. It's much easier to interface with.

NickPlowswell fucked around with this message at 08:07 on Apr 16, 2015

NickPlowswell
Sep 14, 2014

The exoplanet has failed :qq:
I tend to use interfaces a ton when doing stuff like event passing/update methods.

For example, I have some "widget" like structs I use with termbox-go

The interface for them is

code:
type Component interface {
	Draw()
	Event(termbox.Event) bool
}
Then all of my components can live in a struct I call Screen. This allows me to "send" events to every active component and call update functions regardless of which component it is. Additionally, you can do cool things using embedded structs.

With the component example:

code:
type GenericComponent struct{}

func (g *GenericComponent) Draw() {}
func (g *GenericComponent) Event(ev termbox.Event) bool { return true }

type SpecificComponent {
	GenericComponent
}
Now, even though we don't make methods for our SpecificComponent it still satisfies the interface. This is useful if you know you don't need to catch events or draw.

NickPlowswell fucked around with this message at 10:50 on Sep 8, 2015

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply