Skip to content

Commit 6b45a53

Browse files
dbantyGitHub
and
GitHub
authored
chore: prepare release 0.12.0 (#601)
This PR was created by Knope. Merging it will create a new release ### Breaking Changes #### Prevent bumping major version of a `go.mod` file According to [the docs](https://go.dev/blog/v2-go-modules), aside from the `v0` -> `v1` transition, `go.mod` files should not be updated for new major versions, but instead a new `v{major}` directory should be created with a new `go.mod` file. This is for compatibility with older versions of Go tools. In order to prevent someone from accidentally doing the wrong thing, Knope will no longer bump a `go.mod` file to `v2` unless `--override-version` is used to bypass this check. Additionally, if a `go.mod` file is in the matching versioned directory (e.g., the `go.mod` file ending in `/v2` is under a directory called `v2`), Knope will not allow the major version of _that_ file to be bumped, as it would break the package. ### Fixes #### Handle version-specific go modules correctly Fixes #584 from @BatmanAoD. If you have a `go.mod` file representing a specific major version in a directory (as recommended in [the go docs](https://go.dev/blog/v2-go-modules)), Knope will now tag it correctly. Previously, a `v2/go.mod` file would generate a tag like `v2/v2.1.3`. Now, it will generate a tag like `v2.1.3`. Additionally, when determining the _current_ version for a `go.mod` file, only tags which match the major version of the `go.mod` file will be considered. #### Properly version named packages containing a root `go.mod` file Consider this package config in a `knope.toml`: ```toml [packages.something] versioned_files = ["go.mod"] ``` The `Release` step previously (and will still) add a tag like `something/v1.2.3`, however the correct Go module tag is `v1.2.3` (without the package name prefix). Knope will now correctly add this second tag (previously, top-level tags were only added for single-package repos). ### Documentation #### Document conflict between package names and go module names It is possible to write a `knope.toml` file which will cause conflicting tags during the `Release` step if you have `go.mod` files in nested directories. [This is now documented](https://knope-dev.github.io/knope/config/step/Release.html). Co-authored-by: GitHub <[email protected]>
1 parent 2aab7bf commit 6b45a53

6 files changed

+38
-42
lines changed

.changeset/document_known_conflict_between_package_names_and_go_module_names_in_release_step.md

-7
This file was deleted.

.changeset/handle_version_specific_go_modules_correctly.md

-11
This file was deleted.

.changeset/prevent_bumping_a_v1_gomod_file_to_v2.md

-9
This file was deleted.

.changeset/properly_version_named_packages_containing_a_root_gomod_file.md

-14
This file was deleted.

CHANGELOG.md

+37
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,43 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 0.12.0 (2023-09-30)
8+
9+
### Breaking Changes
10+
11+
#### Prevent bumping major version of a `go.mod` file
12+
13+
According to [the docs](https://go.dev/blog/v2-go-modules), aside from the `v0` -> `v1` transition, `go.mod` files should not be updated for new major versions, but instead a new `v{major}` directory should be created with a new `go.mod` file. This is for compatibility with older versions of Go tools.
14+
15+
In order to prevent someone from accidentally doing the wrong thing, Knope will no longer bump a `go.mod` file to `v2` unless `--override-version` is used to bypass this check. Additionally, if a `go.mod` file is in the matching versioned directory (e.g., the `go.mod` file ending in `/v2` is under a directory called `v2`), Knope will not allow the major version of _that_ file to be bumped, as it would break the package.
16+
17+
### Fixes
18+
19+
#### Handle version-specific go modules correctly
20+
21+
Fixes #584 from @BatmanAoD.
22+
23+
If you have a `go.mod` file representing a specific major version in a directory (as recommended in [the go docs](https://go.dev/blog/v2-go-modules)), Knope will now tag it correctly. Previously, a `v2/go.mod` file would generate a tag like `v2/v2.1.3`. Now, it will generate a tag like `v2.1.3`.
24+
25+
Additionally, when determining the _current_ version for a `go.mod` file, only tags which match the major version of the `go.mod` file will be considered.
26+
27+
#### Properly version named packages containing a root `go.mod` file
28+
29+
Consider this package config in a `knope.toml`:
30+
31+
```toml
32+
[packages.something]
33+
versioned_files = ["go.mod"]
34+
```
35+
36+
The `Release` step previously (and will still) add a tag like `something/v1.2.3`, however the correct Go module tag is `v1.2.3` (without the package name prefix). Knope will now correctly add this second tag (previously, top-level tags were only added for single-package repos).
37+
38+
### Documentation
39+
40+
#### Document conflict between package names and go module names
41+
42+
It is possible to write a `knope.toml` file which will cause conflicting tags during the `Release` step if you have `go.mod` files in nested directories. [This is now documented](https://knope-dev.github.io/knope/config/step/Release.html).
43+
744
## 0.11.1 (2023-09-22)
845

946
### Features

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "knope"
33
description = "A command line tool for automating common development tasks"
4-
version = "0.11.1"
4+
version = "0.12.0"
55
authors = ["Dylan Anthony <[email protected]>"]
66
edition = "2021"
77
license = "MIT"

0 commit comments

Comments
 (0)