Skip to content

Commit

Permalink
go: do not change module name
Browse files Browse the repository at this point in the history
Go modules are not only used externally, they are used internally as well.
This means that when changed in a release they effectively break the released
package.

It is not feasible to change all module names with a script, and generally runs
against the preferences of the go community. Unfortunately this does mean that
we'll have to keep an eye out for breaking changes and change the module name
accordingly.
  • Loading branch information
mpkorstanje committed Dec 17, 2022
1 parent bb0440a commit 4b6e520
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 67 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Changelog

## [Unreleased]
### Fixed
- Go: Do not change version in go module ([#88](https://github.com/cucumber/polyglot-release/pull/88))

## [1.3.0] - 2022-12-02
### Fixed
- Go: Only use major version in go module ([#86](https://github.com/cucumber/polyglot-release/pull/86))
- Go: Only use major version in go module ([#86](https://github.com/cucumber/polyglot-release/pull/86))

## [1.2.0] - 2022-11-09
### Added
Expand Down
15 changes: 4 additions & 11 deletions polyglot-release
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,12 @@ function is_monoglot_go() {
[[ -f go.mod ]]
}
function pre_release_go() {
check_for_tools "go" "jq" "sed"
# noop
:
}
function release_go() {
local new_major_version
new_major_version="$(echo "$NEW_VERSION" | sed -E 's/^([0-9]+)\.[0-9]+\.[0-9]+$/\1/')"
# The sed below also captures 3-digit versions
local module_with_new_version
module_with_new_version=$(
go mod edit -json |
jq -r '.Module.Path' |
sed -E "s/(.*)v[0-9]+(\.[0-9]+\.[0-9]+)?$/\1v$new_major_version/"
)
go mod edit -module "$module_with_new_version"
# noop
:
}
function post_release_go() {
# noop
Expand Down
2 changes: 1 addition & 1 deletion polyglot-release-test
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function get_fixture() {
else
fixture=polyglot
fi
echo $fixture
echo "$fixture"
}

function setup_workdir() {
Expand Down
18 changes: 0 additions & 18 deletions tests/fixtures/go-three-digit-version/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions tests/fixtures/go-three-digit-version/go.mod

This file was deleted.

2 changes: 0 additions & 2 deletions tests/only-release-go-three-digit-version.sh

This file was deleted.

25 changes: 0 additions & 25 deletions tests/only-release-go-three-digit-version.sh.expected.git-commits

This file was deleted.

6 changes: 0 additions & 6 deletions tests/only-release-go.sh.expected.git-commits
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,3 @@ diff --git a/CHANGELOG.md b/CHANGELOG.md
-[Unreleased]: https://github.com/cucumber/polyglot-release/compare/v0.0.1...main
+[Unreleased]: https://github.com/cucumber/polyglot-release/compare/v1.0.0...main
+[1.0.0]: https://github.com/cucumber/polyglot-release/compare/v0.0.1...main
diff --git a/go.mod b/go.mod
--- a/go.mod
+++ b/go.mod
@@ -1 +1 @@
-module github.com/example/project/v0
+module github.com/example/project/v1

0 comments on commit 4b6e520

Please sign in to comment.