Skip to content

chore: upgrade to go 1.24 and tool directive in go.mod #209

@meling

Description

@meling

Go 1.24 has support for managing tools via go.mod; see docs and this blog. We should replace the current tools.go files in both the examples module and the main module, and update the make targets accordingly.

  • Upgrade go.mod to 1.24.1
  • Upgrade examples/go.mod to 1.24.1
  • Delete tools.go
  • Delete examples/tools.go
  • Update Makefile to install tools
  • Update examples/Makefile to install tools
  • Update .github/workflows/go-test.yml to 1.24.1
  • Update .github/workflows/golangci-lint.yml to 1.24.1
  • Migrate gorums.code-workspace settings to .vscode/settings.json and add a go.work file for the examples module if necessary.
  • Run go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./...
  • Update Makefile and tests/Makefile to work more seamlessly.
  • Replace protoc with buf?
  • Replace the third_party/status.proto file with the corresponding file from buf's BSR or from protobuf's go-mod path.
  • Replace internal/leakcheck.go with something more robust, such as uber-go/goleak.

The GitHub workflows should also upgrade to newer versions of the various actions.

Moreover, the Makefiles should ideally install versioned copies of the plugins managed by Go, which can be run by go tool protoc-gen-gorums. However, I'm not sure exactly how to run it via the protoc command, like this:

dev: installgorums ordering/ordering.pb.go ordering/ordering_grpc.pb.go
	@rm -f $(dev_path)/zorums*.pb.go
	@protoc -I=$(proto_path) \
		--go_out=:. \
		--gorums_out=dev=true:. \
		--go_opt=default_api_level=API_OPAQUE \
		$(zorums_proto)

Or this:

%.pb.go : %.proto
	@protoc -I=$(proto_path) \
		--go_opt=default_api_level=API_OPAQUE \
		--go_out=paths=source_relative:. $^

However, this should be easy to replace:

$(static_file): $(static_files)
	@cp $(static_file) $(static_file).bak
	@protoc-gen-gorums --bundle=$(static_file)

With something like:

$(static_file): $(static_files)
	@cp $(static_file) $(static_file).bak
	@go tool protoc-gen-gorums --bundle=$(static_file)

I guess, when developing Gorums itself, we should probably use the current branch's code, but it is probably undesirable to install a dev version in the global path. This is because it might impact other modules (dat520, raft, oncetree etc.) that depend on an older version of protoc-gen-gorums.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions