skx / gobasic

A BASIC interpreter written in golang.
https://blog.steve.fi/tags/basic/
GNU General Public License v2.0
328 stars 27 forks source link

Add support for Go Modules #74

Closed udhos closed 5 years ago

udhos commented 5 years ago

Create go.mod and add recipe on how to build gobasic with Go Modules.

skx commented 5 years ago

What advantage does this give?

My understanding is that when people use modules, and avoid GOPATH, they are easily able to vendor their dependencies - they don't need any changes to the libraries they use.

udhos commented 5 years ago

Well, there are several possible benefits from Go Modules. I guess the highlights are:

  1. Moving away from GOPATH
  2. Rewrite import path of dependencies without changing source code
  3. Pin down dependencies to specific versions
skx commented 5 years ago

I don't like rejecting contributions, but I think this is one that I don't see a benefit for.

It seems that go modules are useful for things that have external dependencies - which this project does not. If a project embedded this repository then that could use modules, and vendor this repository. But this repository itself wouldn't need to be updated to use them..

udhos commented 5 years ago

It seems that Go Modules will never be mandatory (one will be able to disable them), but it is likely they will become the default mode starting from 1.13. I guess it may be useful for the Go community to start moving existing Go repositories towards the new model (in order to get experience with it).

Go 1.11, released in August 2018, introduced preliminary support for modules. For now, module support is maintained alongside the traditional GOPATH-based mechanisms. The go command defaults to module mode when run in directory trees outside GOPATH/src and marked by go.mod files in their roots. This setting can be overridden by setting the transitional environment variable $GO111MODULE to on or off; the default behavior is auto mode. We’ve already seen significant adoption of modules across the Go community, along with many helpful suggestions and bug reports to help us improve modules.

Go 1.12, scheduled for February 2019, will refine module support but still leave it in auto mode by default. In addition to many bug fixes and other minor improvements, perhaps the most significant change in Go 1.12 is that commands like go run x.go or go get rsc.io/2fa@v1.1.0 can now operate in GO111MODULE=on mode without an explicit go.mod file.

Our aim is for Go 1.13, scheduled for August 2019, to enable module mode by default (that is, to change the default from auto to on) and deprecate GOPATH mode. In order to do that, we’ve been working on better tooling support along with better support for the open-source module ecosystem.

https://blog.golang.org/modules2019

skx commented 5 years ago

OK you've persuaded me. Will be in the next release. Thank-you for your patience, and contribution.