You've already forked go-semantic-release
Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c8d2d9ade | ||
|
|
8acb8b74b8 | ||
|
|
fd1063132f | ||
|
|
1d0c93b678 | ||
|
|
0c7338ab13 | ||
|
|
03f2eeadaa | ||
|
|
bcb21d917d | ||
|
|
ea2fbfba3d | ||
|
|
c5f993e7de | ||
|
|
ec8dc17df2 | ||
|
|
9e40e81fea | ||
|
|
2782fb5d03 | ||
|
|
0800219d60 | ||
|
|
f89150b698 | ||
|
|
780a6dbc2e | ||
|
|
2d7977993b | ||
|
|
9d7edbf756 | ||
|
|
d9e2f36927 | ||
|
|
a6783f23bd | ||
|
|
fbb3684f68 | ||
|
|
9bc3143f53 | ||
|
|
7b93801e88 | ||
|
|
749bbf720b | ||
|
|
d9e5dc4515 | ||
|
|
d66364e474 | ||
|
|
2fc6145149 | ||
|
|
a054cf9a60 | ||
|
|
155a16ddd5 | ||
|
|
d7878222bb | ||
|
|
f79466b238 | ||
|
|
5225b12c00 | ||
|
|
2cd24777b3 | ||
|
|
cb3084d0b7 | ||
|
|
795f5d54ef | ||
|
|
382cb54bcb | ||
|
|
3bc68d9794 | ||
|
|
c7d6c7cc7b | ||
|
|
47a54436f5 | ||
|
|
deed3a630e | ||
|
|
df058a927f | ||
|
|
5a58d039fb | ||
|
|
08ab3af547 | ||
|
|
7208daed1f | ||
|
|
a20992af14 | ||
|
|
dc4d1c581a | ||
|
|
81bdb68ee4 | ||
|
|
c485c3ee85 | ||
|
|
86c9512479 | ||
|
|
4574d00c28 | ||
|
|
0c4310d60b | ||
|
|
3a37a5e1db | ||
|
|
9594f39caa |
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '21 16 * * 5'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
33
.github/workflows/main.yml
vendored
33
.github/workflows/main.yml
vendored
@@ -1,14 +1,16 @@
|
||||
name: Go
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
go: ["1.13", "1.14", "1.15"]
|
||||
go: ["1.17", "1.18"]
|
||||
env:
|
||||
DEFAULT_GO: "1.18"
|
||||
name: Build with go version ${{ matrix.go }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -21,11 +23,10 @@ jobs:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
export PATH=$PATH:$(go env GOPATH)/bin
|
||||
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.35.2
|
||||
golangci-lint run ./...
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
with:
|
||||
version: latest
|
||||
|
||||
- name: Run tests
|
||||
run: go test ./...
|
||||
@@ -40,8 +41,12 @@ jobs:
|
||||
GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -o build/go-semantic-release.windows_i386.exe -ldflags "-w -s -X main.version=`./build/go-semantic-release-temp next`" ./cmd/go-semantic-release/
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o build/go-semantic-release.windows_x86_64.exe -ldflags "-w -s -X main.version=`./build/go-semantic-release-temp next`" ./cmd/go-semantic-release/
|
||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o build/go-semantic-release.darwin_x86_64 -ldflags "-w -s -X main.version=`./build/go-semantic-release-temp next`" ./cmd/go-semantic-release/
|
||||
- name: Build Docker image
|
||||
if: matrix.go == '1.15'
|
||||
- name: Build Docker image PR
|
||||
if: github.ref != 'refs/heads/master'
|
||||
run: |
|
||||
docker build -t nightapes/go-semantic-release:development-${{matrix.go}} .
|
||||
- name: Build Docker image master
|
||||
if: github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
docker login -u nightapes -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
docker login -u nightapes -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com
|
||||
@@ -50,7 +55,7 @@ jobs:
|
||||
docker tag nightapes/go-semantic-release:development-${{matrix.go}} docker.pkg.github.com/nightapes/go-semantic-release/go-semantic-release:development-${{matrix.go}}
|
||||
docker push docker.pkg.github.com/nightapes/go-semantic-release/go-semantic-release:development-${{matrix.go}}
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: matrix.go == '1.15'
|
||||
if: matrix.go == env.DEFAULT_GO
|
||||
with:
|
||||
name: build
|
||||
path: build
|
||||
@@ -66,6 +71,7 @@ jobs:
|
||||
name: build
|
||||
path: build
|
||||
- name: Release
|
||||
if: github.ref == 'refs/heads/master'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
@@ -73,3 +79,10 @@ jobs:
|
||||
docker login -u nightapes -p ${{ secrets.DOCKER_PASSWORD }}
|
||||
docker login -u nightapes -p $GITHUB_TOKEN docker.pkg.github.com
|
||||
./build/go-semantic-release-temp release --loglevel trace
|
||||
- name: Release PR
|
||||
if: github.ref != 'refs/heads/master'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
chmod -R +x build
|
||||
./build/go-semantic-release-temp release --loglevel trace
|
||||
|
||||
@@ -19,6 +19,8 @@ changelog:
|
||||
docker:
|
||||
latest: true
|
||||
repository: "nightapes/go-semantic-release"
|
||||
showAuthors: true
|
||||
|
||||
hooks:
|
||||
preRelease:
|
||||
- docker build -t nightapes/go-semantic-release:latest .
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
FROM alpine:3.10.2
|
||||
FROM alpine:3.14
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
COPY ./build/go-semantic-release.linux_x86_64 .
|
||||
COPY ./build/go-semantic-release.linux_x86_64 /usr/local/bin/go-semantic-release
|
||||
|
||||
USER 1000
|
||||
|
||||
ENTRYPOINT [ "./go-semantic-release.linux_x86_64" ]
|
||||
ENTRYPOINT [ "go-semantic-release" ]
|
||||
|
||||
14
Makefile
Normal file
14
Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
all: build
|
||||
|
||||
.PHONY: build
|
||||
|
||||
build:
|
||||
go build -o build/go-semantic-release-temp ./cmd/go-semantic-release/
|
||||
|
||||
lint:
|
||||
golangci-lint run --print-issued-lines=false --fix ./...
|
||||
|
||||
test:
|
||||
go test --coverprofile coverage.out -v -parallel 20 ./...
|
||||
118
README.md
118
README.md
@@ -56,6 +56,9 @@ hooks:
|
||||
- name: echo $RELEASE_VERSION
|
||||
postRelease:
|
||||
- name: echo $RELEASE_VERSION
|
||||
integrations:
|
||||
npm:
|
||||
enabled: true
|
||||
```
|
||||
|
||||
#### CommitFormat
|
||||
@@ -125,6 +128,8 @@ gitlab:
|
||||
tagPrefix: ""
|
||||
```
|
||||
|
||||
You can find an example `.gitlab-ci.yml` in the [examples](examples/.gitlab-ci.yml) folder.
|
||||
|
||||
##### Git only
|
||||
|
||||
Only via https at the moment. You need write access to your git repository
|
||||
@@ -157,23 +162,90 @@ assets:
|
||||
#### Hooks
|
||||
|
||||
Hooks will run when calling `release`. Hooks run only if a release will be triggered.
|
||||
You can define hooks which run before or after the release. The shell commands will run in order, you can access the current release version via
|
||||
an environment variable `RELEASE_VERSION`
|
||||
|
||||
```yml
|
||||
hooks:
|
||||
preRelease:
|
||||
- name: echo $RELEASE_VERSION
|
||||
postRelease:
|
||||
- name: echo $RELEASE_VERSION
|
||||
```
|
||||
|
||||
#### Integrations
|
||||
|
||||
Integrations are simple helpers to make integration with existing tools easier.
|
||||
At the moment npm is supported, the integration will set the version before release to the `package.json`
|
||||
```yml
|
||||
integrations:
|
||||
npm:
|
||||
enabled: true
|
||||
```
|
||||
|
||||
#### Changelog
|
||||
|
||||
Following variables can be used for templates:
|
||||
* `Commits` string
|
||||
* `Version` string
|
||||
* `Now` time.Time
|
||||
* `Backtick` string
|
||||
* `HasDocker` bool
|
||||
* `HasDockerLatest` bool
|
||||
* `DockerRepository` string
|
||||
Following variables and objects can be used for templates:
|
||||
|
||||
__Top level__
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------- | ------ | ----- |
|
||||
| `Commits` | string | Fully rendered commit messages. This is left for backward compatibility. |
|
||||
| `CommitsContent` | commitsContent | Raw parsed commit data. Use this if you want to customize the output. |
|
||||
| `Version` | string | Next release version |
|
||||
| `Now` | time.Time | Current time of generating changelog |
|
||||
| `Backtick` | string | Backtick character |
|
||||
| `HasDocker` | bool | If a docker repository is set in the config. |
|
||||
| `HasDockerLatest` | bool | If `latest` image was uploaded |
|
||||
| `DockerRepository` | string | Docker repository |
|
||||
|
||||
__commitsContent__
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------- | ------ | ----- |
|
||||
| `Commits` | map[string][]AnalyzedCommit | Commits grouped by commit type |
|
||||
| `BreakingChanges` | []AnalyzedCommit | Analyzed commit structure |
|
||||
| `Order` | []string | Ordered list of types |
|
||||
| `HasURL` | bool | If a URL is available for commits |
|
||||
| `URL` | string | URL for to the commit with {{hash}} suffix |
|
||||
|
||||
__AnalyzedCommit__
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------- | ------ | ----- |
|
||||
| `Commit` | Commit | Original GIT commit |
|
||||
| `Tag` | string | Type of commit (e.g. feat, fix, ...) |
|
||||
| `TagString` | string | Full name of the type |
|
||||
| `Scope` | bool | Scope value from the commit |
|
||||
| `Subject` | string | URL for to the commit with {{hash}} suffix |
|
||||
| `MessageBlocks` | map[string][]MessageBlock | Different sections of a message (e.g. body, footer etc.) |
|
||||
| `IsBreaking` | bool | If this commit contains a breaking change |
|
||||
| `Print` | bool | Should this commit be included in Changelog output |
|
||||
|
||||
__Commit__
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------- | ------ | ----- |
|
||||
| `Message` | string | Original git commit message |
|
||||
| `Author` | string | Name of the author |
|
||||
| `Hash` | string | Commit hash value "|
|
||||
|
||||
__MessageBlock__
|
||||
|
||||
| Field | Type | Description |
|
||||
| -------- | ------ | ----- |
|
||||
| `Label` | string | Label for a block (optional). This will usually be a token used in a footer |
|
||||
| `Content` | string | The parsed content of a block |
|
||||
|
||||
```yml
|
||||
changelog:
|
||||
printAll: false ## Print all valid commits to changelog
|
||||
title: "v{{.Version}} ({{.Now.Format "2006-01-02"}})" ## Used for releases (go template)
|
||||
templatePath: "./examples/changelog.tmpl" ## Path to a template file (go template)
|
||||
showAuthors: false ## Show authors in changelog
|
||||
showBodyAsHeader: false ## Show all bodies of the commits as header of changelog (useful for squash commit flow to show long text in release)
|
||||
|
||||
```
|
||||
|
||||
##### Docker
|
||||
@@ -187,6 +259,18 @@ changelog:
|
||||
repository: ## Your docker repository, which is used for docker run
|
||||
```
|
||||
|
||||
##### NPM
|
||||
|
||||
You can print a help text for a npm package
|
||||
|
||||
```yml
|
||||
changelog:
|
||||
npm:
|
||||
name: ## Name of the npm package
|
||||
repository: ## Your docker repository, which is used for docker run
|
||||
```
|
||||
|
||||
|
||||
### Version
|
||||
|
||||
`go-semantic-release` has two modes for calculating the version: automatic or manual.
|
||||
@@ -224,6 +308,24 @@ go build -ldflags "--X main.version=`./go-semantic-release next`"
|
||||
./go-semantic-release release
|
||||
```
|
||||
|
||||
### Write changelog to file
|
||||
|
||||
This will write all changes beginning from the last git tag til HEAD to a changelog file.
|
||||
Default changelog file name if nothing is given via `--file`: `CHANGELOG.md`.
|
||||
Note that per default the new changelog will be prepended to the existing file.
|
||||
With `--max-file-size` a maximum sizes of the changelog file in megabytes can be specified.
|
||||
If the size exceeds the limit, the current changelog file will be moved to a new file called `<filename>-<1-n>.<file extension>`. The new changelog will be written to the `<filename>`.
|
||||
The default maximum file size limit is `10 megabytes`.
|
||||
|
||||
```bash
|
||||
./go-semantic-release changelog --max-file-size 10
|
||||
```
|
||||
|
||||
This will overwrite the given changelog file if its existing, if not it will be created.
|
||||
```bash
|
||||
./go-semantic-release changelog --overwrite
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Build from source
|
||||
|
||||
@@ -8,7 +8,10 @@ import (
|
||||
|
||||
func init() {
|
||||
changelogCmd.Flags().Bool("checks", false, "Check for missing values and envs")
|
||||
changelogCmd.Flags().Bool("overwrite", false, "Overwrite the content of the changelog. Default is to prepend the new changelog to the existing file.")
|
||||
changelogCmd.Flags().StringP("out", "o", "CHANGELOG.md", "Name of the file")
|
||||
changelogCmd.Flags().String("from", "", "Generate combined changelog from given version until latest version ")
|
||||
changelogCmd.Flags().Int64("max-file-size", 10, "The max allowed file size in MB for a changelog file. If the file size is larger, the current file will be moved to a new file named <filename>-01.md. The next changelog will be written to de default file.")
|
||||
rootCmd.AddCommand(changelogCmd)
|
||||
}
|
||||
|
||||
@@ -31,6 +34,11 @@ var changelogCmd = &cobra.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
overwrite, err := cmd.Flags().GetBool("overwrite")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
file, err := cmd.Flags().GetString("out")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -41,6 +49,16 @@ var changelogCmd = &cobra.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
fromVersion, err := cmd.Flags().GetString("from")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
maxFileSize, err := cmd.Flags().GetInt64("max-file-size")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s, err := semanticrelease.New(readConfig(config), repository, configChecks)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -51,7 +69,7 @@ var changelogCmd = &cobra.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force)
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, fromVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -61,11 +79,6 @@ var changelogCmd = &cobra.Command{
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = s.WriteChangeLog(generatedChangelog.Content, file); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return s.WriteChangeLog(generatedChangelog.Content, file, overwrite, maxFileSize)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ var hooksCmd = &cobra.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force)
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
62
cmd/go-semantic-release/commands/integrations.go
Normal file
62
cmd/go-semantic-release/commands/integrations.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/Nightapes/go-semantic-release/internal/integrations"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/semanticrelease"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func init() {
|
||||
integrationsCmd.Flags().Bool("checks", false, "Check for missing values and envs")
|
||||
integrationsCmd.Flags().StringP("out", "o", "CHANGELOG.md", "Name of the file")
|
||||
rootCmd.AddCommand(integrationsCmd)
|
||||
}
|
||||
|
||||
var integrationsCmd = &cobra.Command{
|
||||
Use: "integrations",
|
||||
Short: "Call integrations from config file manual",
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
config, err := cmd.Flags().GetString("config")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
repository, err := cmd.Flags().GetString("repository")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
force, err := cmd.Flags().GetBool("no-cache")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
configChecks, err := cmd.Flags().GetBool("checks")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
releaseConfig := readConfig(config)
|
||||
|
||||
s, err := semanticrelease.New(releaseConfig, repository, configChecks)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
provider, err := s.GetCIProvider()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
log.Debugf("Found %d commits till last release", len(releaseVersion.Commits))
|
||||
|
||||
i := integrations.New(&releaseConfig.Integrations, releaseVersion)
|
||||
|
||||
return i.Run()
|
||||
},
|
||||
}
|
||||
@@ -49,7 +49,7 @@ var lastCmd = &cobra.Command{
|
||||
return nil
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force)
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ var nextCmd = &cobra.Command{
|
||||
return nil
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force)
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, "")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
12
examples/.gitlab-ci.yml
Normal file
12
examples/.gitlab-ci.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
stages:
|
||||
- release
|
||||
|
||||
release:
|
||||
stage: release
|
||||
image:
|
||||
name: nightapes/go-semantic-release:latest
|
||||
entrypoint: [""]
|
||||
script:
|
||||
- go-semantic-release next
|
||||
only:
|
||||
- master
|
||||
@@ -1,5 +1,26 @@
|
||||
{{ define "commitList" }}
|
||||
{{ range $index,$commit := .BreakingChanges -}}
|
||||
{{ if eq $index 0 -}}
|
||||
## BREAKING CHANGES
|
||||
{{ end -}}
|
||||
* {{ if $commit.Scope }}**{{$.Backtick}}{{$commit.Scope}}{{$.Backtick}}**{{ end }} {{$commit.ParsedBreakingChangeMessage}}
|
||||
introduced by commit:
|
||||
{{$commit.ParsedMessage}} {{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
{{ end -}}
|
||||
{{ range $key := .Order -}}
|
||||
{{ $commits := index $.Commits $key -}}
|
||||
{{ if $commits -}}
|
||||
### {{ $key }}
|
||||
{{ range $index,$commit := $commits -}}
|
||||
* {{ if $commit.Scope }}**{{$.Backtick}}{{$commit.Scope}}{{$.Backtick}}** {{end}}{{$commit.ParsedMessage}}{{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
# My custom release template v{{$.Version}} ({{.Now.Format "2006-01-02"}})
|
||||
{{ .Commits -}}
|
||||
{{ template "commitList" .CommitsContent -}}
|
||||
|
||||
{{ if .HasDocker}}
|
||||
## Docker image
|
||||
|
||||
|
||||
29
examples/github-actions.yml
Normal file
29
examples/github-actions.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Go
|
||||
on: [ push, pull_request ]
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Init go-semantic-release
|
||||
run: |
|
||||
wget https://github.com/Nightapes/go-semantic-release/releases/download/v2.0.1/go-semantic-release.linux_x86_64.zip
|
||||
unzip go-semantic-release.linux_x86_64.zip
|
||||
chmod +x go-semantic-release.linux_x86_64
|
||||
|
||||
- name: Build binary
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o <your-build-name>.linux_x86_64
|
||||
GOOS=windows GOARCH=386 CGO_ENABLED=0 go build -o <your-build-name>.windows_i386.exe
|
||||
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o <your-build-name>.windows_x86_64.exe
|
||||
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o <your-build-name>.darwin_x86_64
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: ./go-semantic-release.linux_x86_64 release --loglevel trace
|
||||
52
go.mod
52
go.mod
@@ -1,26 +1,48 @@
|
||||
module github.com/Nightapes/go-semantic-release
|
||||
|
||||
go 1.13
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/Masterminds/semver v1.5.0
|
||||
github.com/Microsoft/go-winio v0.4.16 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.0.0
|
||||
github.com/go-git/go-git/v5 v5.2.0
|
||||
github.com/golang/protobuf v1.4.3 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.3.1
|
||||
github.com/go-git/go-git/v5 v5.4.2
|
||||
github.com/google/go-github/v25 v25.1.3
|
||||
github.com/imdario/mergo v0.3.11 // indirect
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/sirupsen/logrus v1.7.0
|
||||
github.com/spf13/cobra v1.1.1
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/spf13/cobra v1.4.0
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
|
||||
golang.org/x/oauth2 v0.0.0-20210113205817-d3ed898aa8a3
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
github.com/tidwall/sjson v1.2.4
|
||||
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20220407094043-a94812496cf5 // indirect
|
||||
github.com/acomagu/bufpipe v1.0.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/emirpasic/gods v1.12.1 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/google/go-cmp v0.5.6 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.0.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/tidwall/gjson v1.14.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
github.com/tidwall/pretty v1.2.0 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.1 // indirect
|
||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 // indirect
|
||||
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3 // indirect
|
||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
|
||||
)
|
||||
|
||||
280
go.sum
280
go.sum
@@ -21,7 +21,6 @@ cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4g
|
||||
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
|
||||
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
|
||||
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
|
||||
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
|
||||
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
|
||||
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
|
||||
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
|
||||
@@ -36,78 +35,54 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
|
||||
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
|
||||
github.com/Microsoft/go-winio v0.4.14 h1:+hMXMk01us9KgxGb7ftKQt2Xpf5hH/yky+TDA+qxleU=
|
||||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
|
||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
|
||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20220407094043-a94812496cf5 h1:cSHEbLj0GZeHM1mWG84qEnGFojNEQ83W7cwaPRjcwXU=
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20220407094043-a94812496cf5/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
|
||||
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
|
||||
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
|
||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/emirpasic/gods v1.12.1 h1:KEXpRg94qvWNpl3F8PRlzJRFhy1kr6SiBiFH6X2Nwp8=
|
||||
github.com/emirpasic/gods v1.12.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM=
|
||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
||||
github.com/go-git/go-git/v5 v5.2.0 h1:YPBLG/3UK1we1ohRkncLjaXWLW+HKp5QNM/jTli2JgI=
|
||||
github.com/go-git/go-git/v5 v5.2.0/go.mod h1:kh02eMX+wdqqxgNMEyq8YgwlIOsDOa9homkUq1PoTMs=
|
||||
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
|
||||
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.2.1 h1:n9gGL1Ct/yIw+nfsfr8s4+sbhT+Ncu2SubfXjIWgci8=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0=
|
||||
github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4=
|
||||
github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc=
|
||||
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
|
||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
@@ -130,26 +105,28 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k=
|
||||
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-github/v25 v25.1.3 h1:Ht4YIQgUh4l4lc80fvGnw60khXysXvlgPxPP8uJG3EA=
|
||||
github.com/google/go-github/v25 v25.1.3/go.mod h1:6z5pC69qHtrPJ0sXPsj4BLnd82b+r6sLB7qcBoRZqpw=
|
||||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
|
||||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
|
||||
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
|
||||
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
|
||||
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
|
||||
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
|
||||
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
|
||||
@@ -162,164 +139,91 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf
|
||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
|
||||
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
|
||||
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
|
||||
github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
|
||||
github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
|
||||
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
|
||||
github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
|
||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
|
||||
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
|
||||
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
|
||||
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
|
||||
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
|
||||
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
|
||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
|
||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v2wtGp9Gmz1Ze3eVRAWJMLokvN3QjdzCHLY=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
|
||||
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
|
||||
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
|
||||
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
|
||||
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
|
||||
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
|
||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
||||
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
|
||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
|
||||
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
|
||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cobra v1.1.1 h1:KfztREH0tPxJJ+geloSLaAkaPkr4ki2Er5quFV1TDo4=
|
||||
github.com/spf13/cobra v1.1.1/go.mod h1:WnodtKOvamDL/PwE2M4iKs8aMDBZ5Q5klgD3qfVJQMI=
|
||||
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
|
||||
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
|
||||
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
|
||||
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
|
||||
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.14.0 h1:6aeJ0bzojgWLa82gDQHcx3S0Lr/O51I9bJ5nv6JFx5w=
|
||||
github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.4 h1:cuiLzLnaMeBhRmEv00Lpk3tkYrcxpmbU81tAY4Dw0tc=
|
||||
github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM=
|
||||
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
|
||||
github.com/xanzy/ssh-agent v0.3.1 h1:AmzO1SSWxw73zxFZPRwaMN1MohDw8UyHnmuxyceTEGo=
|
||||
github.com/xanzy/ssh-agent v0.3.1/go.mod h1:QIE4lCeL7nkC25x+yA3LBIYfwCc1TFziCtG7cBAac6w=
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
|
||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
|
||||
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
|
||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 h1:iU7T1X1J6yxDr0rda54sWGkHgOp5XJrqm79gcNlC2VM=
|
||||
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
|
||||
@@ -352,10 +256,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
@@ -380,16 +280,19 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3 h1:EN5+DfgmRMvRUrMGERW2gQl3Vc+Z7ZMnI/xdEpPSf0c=
|
||||
golang.org/x/net v0.0.0-20220407224826-aac1ed45d8e3/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/oauth2 v0.0.0-20210113205817-d3ed898aa8a3 h1:BaN3BAqnopnKjvl+15DYP6LLrbBHfbfmlFYzmFj/Q9Q=
|
||||
golang.org/x/oauth2 v0.0.0-20210113205817-d3ed898aa8a3/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
|
||||
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a h1:qfl7ob3DIEs3Ml9oLuPwY2N04gymzAW04WsUQHIClgM=
|
||||
golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -398,14 +301,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -432,29 +330,36 @@ golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4 h1:myAQVi0cGEoqQVR5POX+8RR2mrocKqNN1hmeMqhX27k=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f h1:8w7RhxzTVgUzw/AH/9mUV5q0vMgy40SQRursCcfmkCw=
|
||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
@@ -464,7 +369,6 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
|
||||
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191112195655-aa38f8e97acc/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
@@ -492,7 +396,6 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -517,7 +420,6 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7
|
||||
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
|
||||
google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
|
||||
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c=
|
||||
google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
|
||||
@@ -568,34 +470,28 @@ google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQ
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
|
||||
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
|
||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
@@ -2,17 +2,27 @@
|
||||
package analyzer
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/Nightapes/go-semantic-release/internal/shared"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
const breakingChangeKeywords = "BREAKING CHANGE"
|
||||
const defaultBreakingChangePrefix = breakingChangeKeywords + ":"
|
||||
const footerTokenRegex = "^(?P<token>[^\\s*-][\\w\\- ]+[^\\s])<SEP>.*"
|
||||
|
||||
var defaultTokenSeparators = [2]string{": ", " #"}
|
||||
|
||||
// Analyzer struct
|
||||
type Analyzer struct {
|
||||
analyzeCommits analyzeCommits
|
||||
Config config.ChangelogConfig
|
||||
ChangelogConfig config.ChangelogConfig
|
||||
AnalyzerConfig config.AnalyzerConfig
|
||||
}
|
||||
|
||||
// Rule for commits
|
||||
@@ -24,14 +34,15 @@ type Rule struct {
|
||||
}
|
||||
|
||||
type analyzeCommits interface {
|
||||
analyze(commit shared.Commit, tag Rule) (*shared.AnalyzedCommit, bool)
|
||||
analyze(commit shared.Commit, tag Rule) *shared.AnalyzedCommit
|
||||
getRules() []Rule
|
||||
}
|
||||
|
||||
// New Analyzer struct for given commit format
|
||||
func New(format string, config config.ChangelogConfig) (*Analyzer, error) {
|
||||
func New(format string, analyzerConfig config.AnalyzerConfig, chglogConfig config.ChangelogConfig) (*Analyzer, error) {
|
||||
analyzer := &Analyzer{
|
||||
Config: config,
|
||||
AnalyzerConfig: analyzerConfig,
|
||||
ChangelogConfig: chglogConfig,
|
||||
}
|
||||
|
||||
switch format {
|
||||
@@ -39,7 +50,7 @@ func New(format string, config config.ChangelogConfig) (*Analyzer, error) {
|
||||
analyzer.analyzeCommits = newAngular()
|
||||
log.Debugf("Commit format set to %s", ANGULAR)
|
||||
case CONVENTIONAL:
|
||||
analyzer.analyzeCommits = newConventional()
|
||||
analyzer.analyzeCommits = newConventional(analyzerConfig)
|
||||
log.Debugf("Commit format set to %s", CONVENTIONAL)
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid commit format: %s", format)
|
||||
@@ -62,14 +73,14 @@ func (a *Analyzer) Analyze(commits []shared.Commit) map[shared.Release][]shared.
|
||||
|
||||
for _, commit := range commits {
|
||||
for _, rule := range a.analyzeCommits.getRules() {
|
||||
analyzedCommit, hasBreakingChange := a.analyzeCommits.analyze(commit, rule)
|
||||
analyzedCommit := a.analyzeCommits.analyze(commit, rule)
|
||||
if analyzedCommit == nil {
|
||||
continue
|
||||
}
|
||||
if a.Config.PrintAll || rule.Changelog {
|
||||
if a.ChangelogConfig.PrintAll || rule.Changelog {
|
||||
analyzedCommit.Print = true
|
||||
}
|
||||
if hasBreakingChange {
|
||||
if analyzedCommit.IsBreaking {
|
||||
analyzedCommits["major"] = append(analyzedCommits["major"], *analyzedCommit)
|
||||
break
|
||||
}
|
||||
@@ -80,3 +91,114 @@ func (a *Analyzer) Analyze(commits []shared.Commit) map[shared.Release][]shared.
|
||||
log.Debugf("Analyzed commits: major=%d minor=%d patch=%d none=%d", len(analyzedCommits["major"]), len(analyzedCommits["minor"]), len(analyzedCommits["patch"]), len(analyzedCommits["none"]))
|
||||
return analyzedCommits
|
||||
}
|
||||
|
||||
//
|
||||
// getRegexMatchedMap will match a regex with named groups and map the matching
|
||||
// results to corresponding group names
|
||||
//
|
||||
func getRegexMatchedMap(regEx, url string) (paramsMap map[string]string) {
|
||||
var compRegEx = regexp.MustCompile(regEx)
|
||||
match := compRegEx.FindStringSubmatch(url)
|
||||
|
||||
paramsMap = make(map[string]string)
|
||||
for i, name := range compRegEx.SubexpNames() {
|
||||
if i > 0 && i <= len(match) {
|
||||
paramsMap[name] = match[i]
|
||||
}
|
||||
}
|
||||
return paramsMap
|
||||
}
|
||||
|
||||
//
|
||||
// getMessageBlocksFromTexts converts strings to an array of MessageBlock
|
||||
//
|
||||
func getMessageBlocksFromTexts(txtArray, separators []string) []shared.MessageBlock {
|
||||
blocks := make([]shared.MessageBlock, len(txtArray))
|
||||
for i, line := range txtArray {
|
||||
blocks[i] = parseMessageBlock(line, separators)
|
||||
}
|
||||
return blocks
|
||||
}
|
||||
|
||||
//
|
||||
// parseMessageBlock parses a text in to MessageBlock
|
||||
//
|
||||
func parseMessageBlock(msg string, separators []string) shared.MessageBlock {
|
||||
msgBlock := shared.MessageBlock{
|
||||
Label: "",
|
||||
Content: msg,
|
||||
}
|
||||
if token, sep := findFooterToken(msg, separators); len(token) > 0 {
|
||||
msgBlock.Label = token
|
||||
content := strings.Replace(msg, token+sep, "", 1)
|
||||
msgBlock.Content = strings.TrimSpace(content)
|
||||
}
|
||||
return msgBlock
|
||||
}
|
||||
|
||||
//
|
||||
// findFooterToken checks if given text has a token with one of the separators and returns a token
|
||||
//
|
||||
func findFooterToken(text string, separators []string) (token string, sep string) {
|
||||
for _, sep := range separators {
|
||||
regex := strings.Replace(footerTokenRegex, "<SEP>", sep, 1)
|
||||
matches := getRegexMatchedMap(regex, text)
|
||||
if token, ok := matches["token"]; ok {
|
||||
return token, sep
|
||||
}
|
||||
}
|
||||
return "", ""
|
||||
}
|
||||
|
||||
//
|
||||
// getDefaultMessageBlockMap parses a text block and splits in to different sections.
|
||||
// default logic to distinguish different parts is:
|
||||
// - Body starts right after the header (without beginning with a token)
|
||||
// - Body ends when a footer is discovered or text ends
|
||||
// - A footer is detected when it starts with a token ending with a separator
|
||||
// - A footer ends when another footer is found or text ends
|
||||
//
|
||||
func getDefaultMessageBlockMap(txtBlock string, tokenSep []string) map[string][]shared.MessageBlock {
|
||||
msgBlockMap := make(map[string][]shared.MessageBlock)
|
||||
footers := make([]string, 0)
|
||||
body, footerBlock, line := "", "", ""
|
||||
footerFound := false
|
||||
// Look through each line
|
||||
scanner := bufio.NewScanner(strings.NewReader(txtBlock))
|
||||
for scanner.Scan() {
|
||||
line = scanner.Text()
|
||||
if token, _ := findFooterToken(line, tokenSep); len(token) > 0 {
|
||||
// if footer was already found from before
|
||||
if len(footerBlock) > 0 {
|
||||
footers = append(footers, strings.TrimSpace(footerBlock))
|
||||
}
|
||||
footerFound = true
|
||||
footerBlock = ""
|
||||
}
|
||||
|
||||
//'\n' is removed when reading from scanner
|
||||
if !footerFound {
|
||||
body += line + "\n"
|
||||
} else {
|
||||
footerBlock += line + "\n"
|
||||
}
|
||||
}
|
||||
if len(footerBlock) > 0 {
|
||||
footers = append(footers, strings.TrimSpace(footerBlock))
|
||||
}
|
||||
|
||||
body = strings.TrimSpace(body)
|
||||
if len(body) > 0 {
|
||||
msgBlockMap["body"] = []shared.MessageBlock{{
|
||||
Label: "",
|
||||
Content: body,
|
||||
}}
|
||||
}
|
||||
|
||||
footerBlocks := getMessageBlocksFromTexts(footers, tokenSep)
|
||||
if len(footerBlocks) > 0 {
|
||||
msgBlockMap["footer"] = footerBlocks
|
||||
}
|
||||
|
||||
return msgBlockMap
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
|
||||
func TestAnalyzer(t *testing.T) {
|
||||
|
||||
_, err := analyzer.New("unknown", config.ChangelogConfig{})
|
||||
_, err := analyzer.New("unknown", config.AnalyzerConfig{}, config.ChangelogConfig{})
|
||||
assert.Error(t, err)
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package analyzer
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -14,14 +14,17 @@ type angular struct {
|
||||
rules []Rule
|
||||
regex string
|
||||
log *log.Entry
|
||||
config config.AnalyzerConfig
|
||||
}
|
||||
|
||||
// ANGULAR identifier
|
||||
const ANGULAR = "angular"
|
||||
|
||||
var angularFooterTokenSep = defaultTokenSeparators
|
||||
|
||||
func newAngular() *angular {
|
||||
return &angular{
|
||||
regex: `^(TAG)(?:\((.*)\))?: (?s)(.*)`,
|
||||
regex: `^(?P<type>\w*)(?:\((?P<scope>.*)\))?: (?P<subject>.*)`,
|
||||
log: log.WithField("analyzer", ANGULAR),
|
||||
rules: []Rule{
|
||||
{
|
||||
@@ -86,37 +89,54 @@ func (a *angular) getRules() []Rule {
|
||||
return a.rules
|
||||
}
|
||||
|
||||
func (a *angular) analyze(commit shared.Commit, rule Rule) (*shared.AnalyzedCommit, bool) {
|
||||
re := regexp.MustCompile(strings.Replace(a.regex, "TAG", rule.Tag, -1))
|
||||
matches := re.FindStringSubmatch(commit.Message)
|
||||
if matches == nil {
|
||||
a.log.Tracef("%s does not match %s, skip", commit.Message, rule.Tag)
|
||||
return nil, false
|
||||
func (a *angular) analyze(commit shared.Commit, rule Rule) *shared.AnalyzedCommit {
|
||||
tokenSep := append(a.config.TokenSeparators, angularFooterTokenSep[:]...)
|
||||
|
||||
firstSplit := strings.SplitN(commit.Message, "\n", 2)
|
||||
header := firstSplit[0]
|
||||
body := ""
|
||||
if len(firstSplit) > 1 {
|
||||
body = firstSplit[1]
|
||||
}
|
||||
matches := getRegexMatchedMap(a.regex, header)
|
||||
|
||||
if len(matches) == 0 || matches["type"] != rule.Tag {
|
||||
a.log.Tracef("%s does not match %s, skip", commit.Message, rule.Tag)
|
||||
return nil
|
||||
}
|
||||
|
||||
msgBlockMap := getDefaultMessageBlockMap(body, tokenSep)
|
||||
|
||||
log.Debugf("Found commit from Author %s", commit.Author)
|
||||
|
||||
analyzed := &shared.AnalyzedCommit{
|
||||
Commit: commit,
|
||||
Tag: rule.Tag,
|
||||
TagString: rule.TagString,
|
||||
Scope: shared.Scope(matches[2]),
|
||||
Scope: shared.Scope(matches["scope"]),
|
||||
Subject: strings.TrimSpace(matches["subject"]),
|
||||
MessageBlocks: msgBlockMap,
|
||||
}
|
||||
|
||||
message := strings.Join(matches[3:], "")
|
||||
if !strings.Contains(message, "BREAKING CHANGE:") {
|
||||
analyzed.ParsedMessage = strings.Trim(message, " ")
|
||||
isBreaking := strings.Contains(commit.Message, defaultBreakingChangePrefix)
|
||||
analyzed.IsBreaking = isBreaking
|
||||
|
||||
oldFormatMessage := strings.TrimSpace(matches["subject"] + "\n" + body)
|
||||
|
||||
if !isBreaking {
|
||||
analyzed.ParsedMessage = strings.Trim(oldFormatMessage, " ")
|
||||
a.log.Tracef("%s: found %s", commit.Message, rule.Tag)
|
||||
return analyzed, false
|
||||
return analyzed
|
||||
}
|
||||
|
||||
a.log.Tracef(" %s, BREAKING CHANGE found", commit.Message)
|
||||
breakingChange := strings.SplitN(message, "BREAKING CHANGE:", 2)
|
||||
breakingChange := strings.SplitN(oldFormatMessage, defaultBreakingChangePrefix, 2)
|
||||
|
||||
if len(breakingChange) > 1 {
|
||||
analyzed.ParsedMessage = strings.TrimSpace(breakingChange[0])
|
||||
analyzed.ParsedBreakingChangeMessage = strings.TrimSpace(breakingChange[1])
|
||||
return analyzed, true
|
||||
}
|
||||
|
||||
} else {
|
||||
analyzed.ParsedBreakingChangeMessage = breakingChange[0]
|
||||
return analyzed, true
|
||||
}
|
||||
return analyzed
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ func TestAngular(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"major": {},
|
||||
@@ -60,6 +62,8 @@ func TestAngular(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"major": {
|
||||
@@ -75,6 +79,9 @@ func TestAngular(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "change api to v2",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break BREAKING CHANGE: change api to v2",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -120,6 +127,8 @@ func TestAngular(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"major": {
|
||||
@@ -135,6 +144,16 @@ func TestAngular(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "change api to v2",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"footer": {
|
||||
shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "change api to v2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -177,6 +196,8 @@ func TestAngular(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"none": {
|
||||
@@ -192,6 +213,8 @@ func TestAngular(t *testing.T) {
|
||||
TagString: "Changes to CI/CD",
|
||||
Print: false,
|
||||
ParsedBreakingChangeMessage: "",
|
||||
Subject: "my first build",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -212,7 +235,7 @@ func TestAngular(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
angular, err := analyzer.New("angular", config.ChangelogConfig{})
|
||||
angular, err := analyzer.New("angular", config.AnalyzerConfig{}, config.ChangelogConfig{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, test := range testConfigs {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
package analyzer
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
"strings"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -14,14 +14,18 @@ type conventional struct {
|
||||
rules []Rule
|
||||
regex string
|
||||
log *log.Entry
|
||||
config config.AnalyzerConfig
|
||||
}
|
||||
|
||||
// CONVENTIONAL identifier
|
||||
const CONVENTIONAL = "conventional"
|
||||
|
||||
func newConventional() *conventional {
|
||||
var conventionalFooterTokenSep = defaultTokenSeparators
|
||||
|
||||
func newConventional(config config.AnalyzerConfig) *conventional {
|
||||
return &conventional{
|
||||
regex: `^(TAG)(?:\((.*)\))?(\!)?: (?s)(.*)`,
|
||||
config: config,
|
||||
regex: `^(?P<type>\w*)(?:\((?P<scope>.*)\))?(?P<breaking>\!)?: (?P<subject>.*)`,
|
||||
log: log.WithField("analyzer", CONVENTIONAL),
|
||||
rules: []Rule{
|
||||
{
|
||||
@@ -86,37 +90,54 @@ func (a *conventional) getRules() []Rule {
|
||||
return a.rules
|
||||
}
|
||||
|
||||
func (a *conventional) analyze(commit shared.Commit, rule Rule) (*shared.AnalyzedCommit, bool) {
|
||||
re := regexp.MustCompile(strings.Replace(a.regex, "TAG", rule.Tag, -1))
|
||||
matches := re.FindStringSubmatch(commit.Message)
|
||||
if matches == nil {
|
||||
a.log.Tracef("%s does not match %s, skip", commit.Message, rule.Tag)
|
||||
return nil, false
|
||||
func (a *conventional) analyze(commit shared.Commit, rule Rule) *shared.AnalyzedCommit {
|
||||
tokenSep := append(a.config.TokenSeparators, conventionalFooterTokenSep[:]...)
|
||||
|
||||
firstSplit := strings.SplitN(commit.Message, "\n", 2)
|
||||
header := firstSplit[0]
|
||||
body := ""
|
||||
if len(firstSplit) > 1 {
|
||||
body = firstSplit[1]
|
||||
}
|
||||
|
||||
matches := getRegexMatchedMap(a.regex, header)
|
||||
|
||||
if len(matches) == 0 || matches["type"] != rule.Tag {
|
||||
a.log.Tracef("%s does not match %s, skip", commit.Message, rule.Tag)
|
||||
return nil
|
||||
}
|
||||
|
||||
msgBlockMap := getDefaultMessageBlockMap(body, tokenSep)
|
||||
|
||||
analyzed := &shared.AnalyzedCommit{
|
||||
Commit: commit,
|
||||
Tag: rule.Tag,
|
||||
TagString: rule.TagString,
|
||||
Scope: shared.Scope(matches[2]),
|
||||
Scope: shared.Scope(matches["scope"]),
|
||||
Subject: strings.TrimSpace(matches["subject"]),
|
||||
MessageBlocks: msgBlockMap,
|
||||
}
|
||||
|
||||
message := strings.Join(matches[4:], "")
|
||||
if matches[3] == "" && !strings.Contains(message, "BREAKING CHANGE:") {
|
||||
analyzed.ParsedMessage = strings.Trim(message, " ")
|
||||
isBreaking := matches["breaking"] == "!" || strings.Contains(commit.Message, defaultBreakingChangePrefix)
|
||||
analyzed.IsBreaking = isBreaking
|
||||
|
||||
oldFormatMessage := strings.TrimSpace(matches["subject"] + "\n" + body)
|
||||
|
||||
if !isBreaking {
|
||||
analyzed.ParsedMessage = strings.Trim(oldFormatMessage, " ")
|
||||
a.log.Tracef("%s: found %s", commit.Message, rule.Tag)
|
||||
return analyzed, false
|
||||
return analyzed
|
||||
}
|
||||
|
||||
a.log.Infof(" %s, BREAKING CHANGE found", commit.Message)
|
||||
breakingChange := strings.SplitN(message, "BREAKING CHANGE:", 2)
|
||||
breakingChange := strings.SplitN(oldFormatMessage, defaultBreakingChangePrefix, 2)
|
||||
|
||||
if len(breakingChange) > 1 {
|
||||
analyzed.ParsedMessage = strings.TrimSpace(breakingChange[0])
|
||||
analyzed.ParsedBreakingChangeMessage = strings.TrimSpace(breakingChange[1])
|
||||
return analyzed, true
|
||||
} else {
|
||||
analyzed.ParsedBreakingChangeMessage = breakingChange[0]
|
||||
}
|
||||
|
||||
analyzed.ParsedBreakingChangeMessage = breakingChange[0]
|
||||
return analyzed, true
|
||||
return analyzed
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ func TestConventional(t *testing.T) {
|
||||
ParsedMessage: "my first commit",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
Print: true,
|
||||
},
|
||||
{
|
||||
@@ -42,6 +44,8 @@ func TestConventional(t *testing.T) {
|
||||
ParsedMessage: "no scope",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Subject: "no scope",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
Print: true,
|
||||
},
|
||||
},
|
||||
@@ -77,6 +81,8 @@ func TestConventional(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"major": {
|
||||
@@ -92,6 +98,9 @@ func TestConventional(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "my first break",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -125,6 +134,8 @@ func TestConventional(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"major": {
|
||||
@@ -140,6 +151,15 @@ func TestConventional(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "change api to v2",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"footer" : { shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "change api to v2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
@@ -153,6 +173,15 @@ func TestConventional(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "hey from the change",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"footer" : {shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "hey from the change",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -212,6 +241,8 @@ func TestConventional(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"none": {
|
||||
@@ -227,6 +258,8 @@ func TestConventional(t *testing.T) {
|
||||
TagString: "Changes to CI/CD",
|
||||
Print: false,
|
||||
ParsedBreakingChangeMessage: "",
|
||||
Subject: "my first build",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"patch": {},
|
||||
@@ -262,6 +295,8 @@ func TestConventional(t *testing.T) {
|
||||
TagString: "Changes to CI/CD",
|
||||
Print: false,
|
||||
ParsedBreakingChangeMessage: "",
|
||||
Subject: "my first build",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
"patch": {{
|
||||
@@ -275,6 +310,8 @@ func TestConventional(t *testing.T) {
|
||||
Tag: "fix",
|
||||
TagString: "Bug fixes",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
}},
|
||||
"major": {},
|
||||
},
|
||||
@@ -293,7 +330,7 @@ func TestConventional(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
conventional, err := analyzer.New("conventional", config.ChangelogConfig{})
|
||||
conventional, err := analyzer.New("conventional", config.AnalyzerConfig{}, config.ChangelogConfig{})
|
||||
assert.NoError(t, err)
|
||||
|
||||
for _, test := range testConfigs {
|
||||
@@ -304,3 +341,156 @@ func TestConventional(t *testing.T) {
|
||||
assert.Equalf(t, test.wantAnalyzedCommits["none"], analyzedCommits["none"], "Testcase %s should have none commits", test.testCase)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConventional_BodyAndFooters(t *testing.T) {
|
||||
t.Parallel()
|
||||
testConfigs := []struct {
|
||||
testCase string
|
||||
commits []shared.Commit
|
||||
expectedAnalyzedCommits map[shared.Release][]shared.AnalyzedCommit
|
||||
}{
|
||||
{
|
||||
testCase: "Only body, no footer",
|
||||
commits: []shared.Commit{
|
||||
{
|
||||
Message: "fix: squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
},
|
||||
expectedAnalyzedCommits: map[shared.Release][]shared.AnalyzedCommit{
|
||||
"patch": {
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "fix: squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "",
|
||||
ParsedMessage: "squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout",
|
||||
Tag: "fix",
|
||||
TagString: "Bug fixes",
|
||||
Print: true,
|
||||
Subject: "squash bug for logging",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {
|
||||
shared.MessageBlock{
|
||||
Label: "",
|
||||
Content: "Now the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"major": {},
|
||||
"minor": {},
|
||||
"none": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
testCase: "Only footers, no body",
|
||||
commits: []shared.Commit{
|
||||
{
|
||||
Message: "fix: squash bug for logging\n\nNote: now the logs will not print lines twice.\n\nIssue: #123\nSeverity: medium",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
},
|
||||
expectedAnalyzedCommits: map[shared.Release][]shared.AnalyzedCommit{
|
||||
"patch": {
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "fix: squash bug for logging\n\nNote: now the logs will not print lines twice.\n\nIssue: #123\nSeverity: medium",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "",
|
||||
ParsedMessage: "squash bug for logging\n\nNote: now the logs will not print lines twice.\n\nIssue: #123\nSeverity: medium",
|
||||
Tag: "fix",
|
||||
TagString: "Bug fixes",
|
||||
Print: true,
|
||||
Subject: "squash bug for logging",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"footer": {
|
||||
shared.MessageBlock{
|
||||
Label: "Note",
|
||||
Content: "now the logs will not print lines twice.",
|
||||
},
|
||||
shared.MessageBlock{
|
||||
Label: "Issue",
|
||||
Content: "#123",
|
||||
},
|
||||
shared.MessageBlock{
|
||||
Label: "Severity",
|
||||
Content: "medium",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"major": {},
|
||||
"minor": {},
|
||||
"none": {},
|
||||
},
|
||||
},
|
||||
{
|
||||
testCase: "Body and footers",
|
||||
commits: []shared.Commit{
|
||||
{
|
||||
Message: "fix: squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout\n\nIssue: #123\nSeverity: medium",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
},
|
||||
expectedAnalyzedCommits: map[shared.Release][]shared.AnalyzedCommit{
|
||||
"patch": {
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "fix: squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout\n\nIssue: #123\nSeverity: medium",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "",
|
||||
ParsedMessage: "squash bug for logging\n\nNow the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout\n\nIssue: #123\nSeverity: medium",
|
||||
Tag: "fix",
|
||||
TagString: "Bug fixes",
|
||||
Print: true,
|
||||
Subject: "squash bug for logging",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {
|
||||
shared.MessageBlock{
|
||||
Label: "",
|
||||
Content: "Now the logs will not print lines twice. The following changed:\n\n-Buffer -Stdout",
|
||||
},
|
||||
},
|
||||
"footer": {
|
||||
shared.MessageBlock{
|
||||
Label: "Issue",
|
||||
Content: "#123",
|
||||
},
|
||||
shared.MessageBlock{
|
||||
Label: "Severity",
|
||||
Content: "medium",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"major": {},
|
||||
"minor": {},
|
||||
"none": {},
|
||||
},
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
conventional, err := analyzer.New("conventional", config.AnalyzerConfig{}, config.ChangelogConfig{})
|
||||
assert.NoError(t, err)
|
||||
for _, test := range testConfigs {
|
||||
analyzedCommits := conventional.Analyze(test.commits)
|
||||
assert.Equalf(t, test.expectedAnalyzedCommits["major"], analyzedCommits["major"], "Testcase %s should have major commits", test.testCase)
|
||||
assert.Equalf(t, test.expectedAnalyzedCommits["minor"], analyzedCommits["minor"], "Testcase %s should have minor commits", test.testCase)
|
||||
assert.Equalf(t, test.expectedAnalyzedCommits["patch"], analyzedCommits["patch"], "Testcase %s should have patch commits", test.testCase)
|
||||
assert.Equalf(t, test.expectedAnalyzedCommits["none"], analyzedCommits["none"], "Testcase %s should have none commits", test.testCase)
|
||||
}
|
||||
}
|
||||
|
||||
2
internal/cache/cache_test.go
vendored
2
internal/cache/cache_test.go
vendored
@@ -69,6 +69,8 @@ func TestWriteAndReadCache(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "add gitlab as release option",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package changelog
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
"time"
|
||||
@@ -20,20 +22,45 @@ const defaultCommitList string = `{{ range $index,$commit := .BreakingChanges -}
|
||||
{{ end -}}
|
||||
* {{ if $commit.Scope }}**{{$.Backtick}}{{$commit.Scope}}{{$.Backtick}}**{{ end }} {{$commit.ParsedBreakingChangeMessage}}
|
||||
introduced by commit:
|
||||
{{$commit.ParsedMessage}} {{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
{{$commit.Subject}} {{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
{{ end -}}
|
||||
{{ range $key := .Order -}}
|
||||
{{ $commits := index $.Commits $key -}}
|
||||
{{ if $commits -}}
|
||||
### {{ $key }}
|
||||
{{ range $index,$commit := $commits -}}
|
||||
* {{ if $commit.Scope }}**{{$.Backtick}}{{$commit.Scope}}{{$.Backtick}}** {{end}}{{$commit.ParsedMessage}}{{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
* {{ if $commit.Scope }}**{{$.Backtick}}{{$commit.Scope}}{{$.Backtick}}** {{end}}{{$commit.Subject}}{{if $.HasURL}} ([{{ printf "%.7s" $commit.Commit.Hash}}]({{ replace $.URL "{{hash}}" $commit.Commit.Hash}})){{end}}
|
||||
{{ if not $.ShowBodyAsHeader -}}
|
||||
{{ if $commit.MessageBlocks.body -}}
|
||||
{{ range $indexBlock,$bodyBlock := $commit.MessageBlocks.body -}}
|
||||
{{ addPrefixToLines $bodyBlock.Content " > "}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}`
|
||||
const defaultChangelogTitle string = `v{{.Version}} ({{.Now.Format "2006-01-02"}})`
|
||||
const defaultChangelog string = `# v{{$.Version}} ({{.Now.Format "2006-01-02"}})
|
||||
{{ .Commits -}}
|
||||
const defaultCommitListSubTemplate = `{{ define "commitList" }}` + defaultCommitList + "{{ end }}"
|
||||
const defaultChangelogTitle = `v{{.Version}} ({{.Now.Format "2006-01-02"}})`
|
||||
const defaultChangelog = `# v{{$.Version}} ({{.Now.Format "2006-01-02"}})
|
||||
{{ if .ShowBodyAsHeader -}}
|
||||
|
||||
{{ range $key := .CommitsContent.Order -}}
|
||||
{{ $commits := index $.CommitsContent.Commits $key -}}
|
||||
{{ if $commits -}}
|
||||
{{ range $index,$commit := $commits -}}
|
||||
{{ if $commit.MessageBlocks.body -}}
|
||||
{{ range $indexBlock,$bodyBlock := $commit.MessageBlocks.body -}}
|
||||
{{ $bodyBlock.Content }}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ template "commitList" .CommitsContent -}}
|
||||
|
||||
{{ if .HasDocker}}
|
||||
## Docker image
|
||||
|
||||
@@ -48,24 +75,52 @@ or
|
||||
{{$.Backtick}}docker run {{.DockerRepository}}:latest{{$.Backtick}}
|
||||
{{ end -}}
|
||||
{{ end -}}
|
||||
|
||||
{{ if .HasNPM}}
|
||||
## NodeJS Package
|
||||
|
||||
New NodeJS package is released under [{{.NPMPackageName}}]({{.NPMRepository}})
|
||||
|
||||
### Usage
|
||||
|
||||
{{$.Backtick}}yarn add {{.NPMPackageName}}@{{.Version}}{{$.Backtick}}
|
||||
|
||||
or
|
||||
|
||||
{{$.Backtick}}npm install -save {{.NPMPackageName}}@{{.Version}}{{$.Backtick}}
|
||||
|
||||
{{ end -}}
|
||||
|
||||
{{ if .ShowAuthors -}}
|
||||
# Special Thanks
|
||||
|
||||
{{range $i,$a := .Authors}}{{if gt $i 0 }}, {{end}}{{$a}}{{end}}
|
||||
{{ end -}}
|
||||
`
|
||||
|
||||
type changelogContent struct {
|
||||
Commits string
|
||||
CommitsContent commitsContent
|
||||
Version string
|
||||
Now time.Time
|
||||
Backtick string
|
||||
ShowBodyAsHeader bool
|
||||
HasDocker bool
|
||||
HasDockerLatest bool
|
||||
DockerRepository string
|
||||
HasNPM bool
|
||||
IsYarn bool
|
||||
NPMRepository string
|
||||
NPMPackageName string
|
||||
Authors []string
|
||||
ShowAuthors bool
|
||||
}
|
||||
|
||||
type commitsContent struct {
|
||||
Commits map[string][]shared.AnalyzedCommit
|
||||
BreakingChanges []shared.AnalyzedCommit
|
||||
Order []string
|
||||
Version string
|
||||
Now time.Time
|
||||
ShowBodyAsHeader bool
|
||||
Backtick string
|
||||
HasURL bool
|
||||
URL string
|
||||
@@ -89,11 +144,11 @@ func New(config *config.ReleaseConfig, rules []analyzer.Rule, releaseTime time.T
|
||||
}
|
||||
}
|
||||
|
||||
// GenerateChanglog from given commits
|
||||
func (c *Changelog) GenerateChanglog(templateConfig shared.ChangelogTemplateConfig, analyzedCommits map[shared.Release][]shared.AnalyzedCommit) (*shared.GeneratedChangelog, error) {
|
||||
// GenerateChangelog from given commits
|
||||
func (c *Changelog) GenerateChangelog(templateConfig shared.ChangelogTemplateConfig, analyzedCommits map[shared.Release][]shared.AnalyzedCommit) (*shared.GeneratedChangelog, error) {
|
||||
|
||||
commitsPerScope := map[string][]shared.AnalyzedCommit{}
|
||||
commitsBreakingChange := []shared.AnalyzedCommit{}
|
||||
var commitsBreakingChange []shared.AnalyzedCommit
|
||||
order := make([]string, 0)
|
||||
|
||||
for _, rule := range c.rules {
|
||||
@@ -103,10 +158,13 @@ func (c *Changelog) GenerateChanglog(templateConfig shared.ChangelogTemplateConf
|
||||
}
|
||||
}
|
||||
|
||||
authors := map[string]bool{}
|
||||
|
||||
for _, commits := range analyzedCommits {
|
||||
for _, commit := range commits {
|
||||
authors[commit.Commit.Author] = true
|
||||
if commit.Print {
|
||||
if commit.ParsedBreakingChangeMessage != "" {
|
||||
if commit.IsBreaking {
|
||||
commitsBreakingChange = append(commitsBreakingChange, commit)
|
||||
continue
|
||||
}
|
||||
@@ -119,31 +177,47 @@ func (c *Changelog) GenerateChanglog(templateConfig shared.ChangelogTemplateConf
|
||||
}
|
||||
|
||||
commitsContent := commitsContent{
|
||||
Version: templateConfig.Version,
|
||||
Commits: commitsPerScope,
|
||||
Now: c.releaseTime,
|
||||
BreakingChanges: commitsBreakingChange,
|
||||
Backtick: "`",
|
||||
Order: order,
|
||||
ShowBodyAsHeader: c.config.Changelog.ShowBodyAsHeader,
|
||||
HasURL: templateConfig.CommitURL != "",
|
||||
URL: templateConfig.CommitURL,
|
||||
}
|
||||
|
||||
authorsNames := make([]string, len(authors))
|
||||
i := 0
|
||||
for k := range authors {
|
||||
authorsNames[i] = k
|
||||
i++
|
||||
}
|
||||
|
||||
sort.Strings(authorsNames)
|
||||
|
||||
changelogContent := changelogContent{
|
||||
CommitsContent: commitsContent,
|
||||
Version: templateConfig.Version,
|
||||
Now: c.releaseTime,
|
||||
Backtick: "`",
|
||||
HasDocker: c.config.Changelog.Docker.Repository != "",
|
||||
HasDockerLatest: c.config.Changelog.Docker.Latest,
|
||||
DockerRepository: c.config.Changelog.Docker.Repository,
|
||||
HasNPM: c.config.Changelog.NPM.PackageName != "",
|
||||
NPMPackageName: c.config.Changelog.NPM.PackageName,
|
||||
NPMRepository: c.config.Changelog.NPM.Repository,
|
||||
ShowBodyAsHeader: c.config.Changelog.ShowBodyAsHeader,
|
||||
ShowAuthors: c.config.Changelog.ShowAuthors && len(authors) > 0,
|
||||
Authors: authorsNames,
|
||||
}
|
||||
template := defaultChangelog
|
||||
|
||||
chglogTemplate := defaultCommitListSubTemplate + defaultChangelog
|
||||
if c.config.Changelog.TemplatePath != "" {
|
||||
content, err := ioutil.ReadFile(c.config.Changelog.TemplatePath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
template = string(content)
|
||||
chglogTemplate = string(content)
|
||||
}
|
||||
|
||||
templateTitle := defaultChangelogTitle
|
||||
@@ -152,30 +226,41 @@ func (c *Changelog) GenerateChanglog(templateConfig shared.ChangelogTemplateConf
|
||||
}
|
||||
|
||||
log.Debugf("Render title")
|
||||
renderedTitle, err := generateTemplate(templateTitle, changelogContent)
|
||||
renderedTitle, err := generateTemplate(templateTitle, changelogContent, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("Render commits")
|
||||
renderedCommitList, err := generateTemplate(defaultCommitList, commitsContent)
|
||||
renderedCommitList, err := generateTemplate(defaultCommitList, commitsContent, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Tracef("Commits %s", renderedCommitList)
|
||||
|
||||
changelogContent.Commits = renderedCommitList
|
||||
|
||||
extraFuncMap := template.FuncMap{
|
||||
"commitUrl": func() string { return templateConfig.CommitURL },
|
||||
}
|
||||
log.Debugf("Render changelog")
|
||||
renderedContent, err := generateTemplate(template, changelogContent)
|
||||
renderedContent, err := generateTemplate(chglogTemplate, changelogContent, extraFuncMap)
|
||||
|
||||
return &shared.GeneratedChangelog{Title: renderedTitle, Content: renderedContent}, err
|
||||
}
|
||||
|
||||
func generateTemplate(text string, values interface{}) (string, error) {
|
||||
func generateTemplate(text string, values interface{}, extraFuncMap template.FuncMap) (string, error) {
|
||||
|
||||
funcMap := template.FuncMap{
|
||||
"replace": replace,
|
||||
"lower": lower,
|
||||
"upper": upper,
|
||||
"capitalize": capitalize,
|
||||
"addPrefixToLines": addPrefixToLines,
|
||||
}
|
||||
|
||||
for k, v := range extraFuncMap {
|
||||
funcMap[k] = v
|
||||
}
|
||||
|
||||
var tpl bytes.Buffer
|
||||
@@ -193,3 +278,30 @@ func generateTemplate(text string, values interface{}) (string, error) {
|
||||
func replace(input, from, to string) string {
|
||||
return strings.Replace(input, from, to, -1)
|
||||
}
|
||||
|
||||
func lower(input string) string {
|
||||
return strings.ToLower(input)
|
||||
}
|
||||
|
||||
func upper(input string) string {
|
||||
return strings.ToUpper(input)
|
||||
}
|
||||
|
||||
func capitalize(input string) string {
|
||||
if len(input) > 0 {
|
||||
return strings.ToUpper(string(input[0])) + input[1:]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Adds a prefix to each line of the given text block
|
||||
// this can be helpful in rendering correct indentation or bullets for multi-line texts
|
||||
func addPrefixToLines(input, prefix string) string {
|
||||
output := ""
|
||||
scanner := bufio.NewScanner(strings.NewReader(input))
|
||||
for scanner.Scan() {
|
||||
output += prefix + scanner.Text() + "\n"
|
||||
}
|
||||
output = strings.TrimRight(output, "\n")
|
||||
return output
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ func TestChangelog(t *testing.T) {
|
||||
analyzedCommits map[shared.Release][]shared.AnalyzedCommit
|
||||
result *shared.GeneratedChangelog
|
||||
hasError bool
|
||||
showAuthors bool
|
||||
}{
|
||||
{
|
||||
testCase: "feat",
|
||||
@@ -41,6 +42,8 @@ func TestChangelog(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -50,6 +53,46 @@ func TestChangelog(t *testing.T) {
|
||||
},
|
||||
hasError: false,
|
||||
},
|
||||
{
|
||||
testCase: "feat with authors",
|
||||
showAuthors: true,
|
||||
analyzedCommits: map[shared.Release][]shared.AnalyzedCommit{
|
||||
"minor": {
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "feat(internal/changelog): my first commit",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "internal/changelog",
|
||||
ParsedMessage: "my first commit",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "feat(internal/changelog): my second commit",
|
||||
Author: "secondAuthor",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "internal/changelog",
|
||||
ParsedMessage: "my second commit",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my second commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
},
|
||||
result: &shared.GeneratedChangelog{
|
||||
Title: "v1.0.0 (2019-07-19)",
|
||||
Content: "# v1.0.0 (2019-07-19)\n### Features\n* **`internal/changelog`** my first commit ([1234566](https://commit.url))\n* **`internal/changelog`** my second commit ([1234566](https://commit.url))\n# Special Thanks\n\nme, secondAuthor\n"},
|
||||
hasError: false,
|
||||
},
|
||||
{
|
||||
testCase: "feat no scope",
|
||||
analyzedCommits: map[shared.Release][]shared.AnalyzedCommit{
|
||||
@@ -64,6 +107,8 @@ func TestChangelog(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -88,6 +133,8 @@ func TestChangelog(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
@@ -101,6 +148,15 @@ func TestChangelog(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "change api to v2",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "change api to v2",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -126,6 +182,15 @@ func TestChangelog(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "hey from the change",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "hey from the change",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
@@ -138,6 +203,8 @@ func TestChangelog(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
@@ -150,10 +217,12 @@ func TestChangelog(t *testing.T) {
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my second commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "feat: my new commit \n\nmy first break: BREAKING CHANGE: change api to v2",
|
||||
Message: "feat: my first break \n\nBREAKING CHANGE: change api to v2",
|
||||
Author: "me",
|
||||
Hash: "12345668",
|
||||
},
|
||||
@@ -163,6 +232,35 @@ func TestChangelog(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "change api to v2",
|
||||
IsBreaking: true,
|
||||
Subject: "my first break",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {shared.MessageBlock{
|
||||
Label: "BREAKING CHANGE",
|
||||
Content: "change api to v2",
|
||||
}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "feat: my awesome features \n\n * Feature1: Lists in changelog \n* Feature2: Lists in changelog2",
|
||||
Author: "me",
|
||||
Hash: "12345668",
|
||||
},
|
||||
Scope: "",
|
||||
ParsedMessage: "my awesome features",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "",
|
||||
IsBreaking: false,
|
||||
Subject: "my awesome features",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{
|
||||
"body": {shared.MessageBlock{
|
||||
Label: "",
|
||||
Content: "* Feature1: Lists in changelog \n* Feature2: Lists in changelog2",
|
||||
}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
@@ -176,18 +274,27 @@ func TestChangelog(t *testing.T) {
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
ParsedBreakingChangeMessage: "my next commit",
|
||||
IsBreaking: true,
|
||||
Subject: "my next commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
},
|
||||
result: &shared.GeneratedChangelog{
|
||||
Title: "v1.0.0 (2019-07-19)",
|
||||
Content: "# v1.0.0 (2019-07-19)\n## BREAKING CHANGES\n* hey from the change \nintroduced by commit: \nmy first break ([1234566](https://commit.url))\n* change api to v2 \nintroduced by commit: \nmy first break ([1234566](https://commit.url))\n* my next commit \nintroduced by commit: \n ([1234566](https://commit.url))\n### Features\n* **`internal/changelog`** my first commit ([1234566](https://commit.url))\n* my first commit ([1234566](https://commit.url))\n",
|
||||
},
|
||||
Content: "# v1.0.0 (2019-07-19)\n## BREAKING CHANGES\n* hey from the change \nintroduced by commit: \nmy first break ([1234566](https://commit.url))\n* change api to v2 \nintroduced by commit: \nmy first break ([1234566](https://commit.url))\n* my next commit \nintroduced by commit: \nmy next commit ([1234566](https://commit.url))\n### Features\n* **`internal/changelog`** my first commit ([1234566](https://commit.url))\n* my second commit ([1234566](https://commit.url))\n* my awesome features ([1234566](https://commit.url))\n > * Feature1: Lists in changelog \n > * Feature2: Lists in changelog2\n"},
|
||||
hasError: false,
|
||||
},
|
||||
}
|
||||
|
||||
cl := changelog.New(&config.ReleaseConfig{}, []analyzer.Rule{
|
||||
for _, testConfig := range testConfigs {
|
||||
t.Run(testConfig.testCase, func(t *testing.T) {
|
||||
cl := changelog.New(&config.ReleaseConfig{
|
||||
Changelog: config.ChangelogConfig{
|
||||
ShowBodyAsHeader: false,
|
||||
ShowAuthors: testConfig.showAuthors,
|
||||
},
|
||||
}, []analyzer.Rule{
|
||||
{
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
@@ -208,10 +315,98 @@ func TestChangelog(t *testing.T) {
|
||||
},
|
||||
}, time.Date(2019, 7, 19, 0, 0, 0, 0, time.UTC))
|
||||
|
||||
generatedChangelog, err := cl.GenerateChangelog(templateConfig, testConfig.analyzedCommits)
|
||||
assert.Equalf(t, testConfig.hasError, err != nil, "Testcase %s should have error: %t -> %s", testConfig.testCase, testConfig.hasError, err)
|
||||
assert.Equalf(t, testConfig.result, generatedChangelog, "Testcase %s should have generated changelog", testConfig.testCase)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestChangelogExtensions(t *testing.T) {
|
||||
|
||||
testConfigs := []struct {
|
||||
testCase string
|
||||
result *shared.GeneratedChangelog
|
||||
releaseConfig *config.ReleaseConfig
|
||||
}{
|
||||
{
|
||||
testCase: "docker",
|
||||
releaseConfig: &config.ReleaseConfig{
|
||||
Changelog: config.ChangelogConfig{
|
||||
Docker: config.ChangelogDocker{
|
||||
Latest: true,
|
||||
Repository: "mydocker.de",
|
||||
},
|
||||
NPM: config.ChangelogNPM{},
|
||||
},
|
||||
},
|
||||
result: &shared.GeneratedChangelog{Title: "v1.0.0 (2019-07-19)", Content: "# v1.0.0 (2019-07-19)\n### Features\n* **`internal/changelog`** my first commit ([1234566](https://commit.url))\n\n## Docker image\n\nNew docker image is released under `mydocker.de:1.0.0`\n\n### Usage\n\n`docker run mydocker.de:1.0.0`\n\nor\n\n`docker run mydocker.de:latest`\n"},
|
||||
},
|
||||
{
|
||||
testCase: "npm",
|
||||
releaseConfig: &config.ReleaseConfig{
|
||||
Changelog: config.ChangelogConfig{
|
||||
Docker: config.ChangelogDocker{},
|
||||
NPM: config.ChangelogNPM{
|
||||
Repository: "https://github.com/Nightapes/ngx-validators/packages/102720",
|
||||
PackageName: "ngx-validators",
|
||||
},
|
||||
},
|
||||
},
|
||||
result: &shared.GeneratedChangelog{Title: "v1.0.0 (2019-07-19)", Content: "# v1.0.0 (2019-07-19)\n### Features\n* **`internal/changelog`** my first commit ([1234566](https://commit.url))\n\n## NodeJS Package\n\nNew NodeJS package is released under [ngx-validators](https://github.com/Nightapes/ngx-validators/packages/102720)\n\n### Usage\n\n`yarn add ngx-validators@1.0.0`\n\nor\n\n`npm install -save ngx-validators@1.0.0`\n\n"},
|
||||
},
|
||||
}
|
||||
|
||||
analyzedCommits := map[shared.Release][]shared.AnalyzedCommit{
|
||||
"minor": {
|
||||
{
|
||||
Commit: shared.Commit{
|
||||
Message: "feat(internal/changelog): my first commit",
|
||||
Author: "me",
|
||||
Hash: "12345667",
|
||||
},
|
||||
Scope: "internal/changelog",
|
||||
ParsedMessage: "my first commit",
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Print: true,
|
||||
Subject: "my first commit",
|
||||
MessageBlocks: map[string][]shared.MessageBlock{},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, config := range testConfigs {
|
||||
t.Run(config.testCase, func(t *testing.T) {
|
||||
generatedChangelog, err := cl.GenerateChanglog(templateConfig, config.analyzedCommits)
|
||||
assert.Equalf(t, config.hasError, err != nil, "Testcase %s should have error: %t -> %s", config.testCase, config.hasError, err)
|
||||
templateConfig := shared.ChangelogTemplateConfig{
|
||||
CommitURL: "https://commit.url",
|
||||
CompareURL: "https://compare.url",
|
||||
Hash: "hash",
|
||||
Version: "1.0.0",
|
||||
}
|
||||
cl := changelog.New(config.releaseConfig, []analyzer.Rule{
|
||||
{
|
||||
Tag: "feat",
|
||||
TagString: "Features",
|
||||
Release: "minor",
|
||||
Changelog: true,
|
||||
},
|
||||
{
|
||||
Tag: "fix",
|
||||
TagString: "Bug fixes",
|
||||
Release: "patch",
|
||||
Changelog: true,
|
||||
},
|
||||
{
|
||||
Tag: "build",
|
||||
TagString: "Build",
|
||||
Release: "none",
|
||||
Changelog: false,
|
||||
},
|
||||
}, time.Date(2019, 7, 19, 0, 0, 0, 0, time.UTC))
|
||||
generatedChangelog, err := cl.GenerateChangelog(templateConfig, analyzedCommits)
|
||||
assert.NoError(t, err)
|
||||
assert.Equalf(t, config.result, generatedChangelog, "Testcase %s should have generated changelog", config.testCase)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ package gitutil
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"sort"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/Nightapes/go-semantic-release/internal/shared"
|
||||
"github.com/go-git/go-git/v5"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"github.com/go-git/go-git/v5/plumbing/object"
|
||||
"github.com/go-git/go-git/v5/plumbing/storer"
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -77,14 +77,30 @@ func (g *GitUtil) GetBranch() (string, error) {
|
||||
}
|
||||
|
||||
// GetLastVersion from git tags
|
||||
func (g *GitUtil) GetLastVersion() (*semver.Version, string, error) {
|
||||
func (g *GitUtil) GetVersion(version string) (*semver.Version, *plumbing.Reference, error) {
|
||||
|
||||
v, err := semver.NewVersion(version)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
tag, err := g.Repository.Tag(version)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
log.Debugf("Found old hash %s", tag.Hash().String())
|
||||
return v, tag, nil
|
||||
}
|
||||
|
||||
// GetLastVersion from git tags
|
||||
func (g *GitUtil) GetLastVersion() (*semver.Version, *plumbing.Reference, error) {
|
||||
|
||||
var tags []*semver.Version
|
||||
|
||||
gitTags, err := g.Repository.Tags()
|
||||
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
err = gitTags.ForEach(func(p *plumbing.Reference) error {
|
||||
@@ -100,63 +116,75 @@ func (g *GitUtil) GetLastVersion() (*semver.Version, string, error) {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
sort.Sort(sort.Reverse(semver.Collection(tags)))
|
||||
|
||||
if len(tags) == 0 {
|
||||
log.Debugf("Found no tags")
|
||||
return nil, "", nil
|
||||
return nil, nil, nil
|
||||
}
|
||||
|
||||
log.Debugf("Found old version %s", tags[0].String())
|
||||
|
||||
tag, err := g.Repository.Tag(tags[0].Original())
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
log.Debugf("Found old hash %s", tag.Hash().String())
|
||||
return tags[0], tag.Hash().String(), nil
|
||||
return tags[0], tag, nil
|
||||
}
|
||||
|
||||
// GetCommits from git hash to HEAD
|
||||
func (g *GitUtil) GetCommits(lastTagHash string) ([]shared.Commit, error) {
|
||||
func (g *GitUtil) GetCommits(lastTagHash *plumbing.Reference) ([]shared.Commit, error) {
|
||||
|
||||
ref, err := g.Repository.Head()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
logOptions := &git.LogOptions{From: ref.Hash()}
|
||||
|
||||
cIter, err := g.Repository.Log(&git.LogOptions{From: ref.Hash(), Order: git.LogOrderCommitterTime})
|
||||
if lastTagHash != nil {
|
||||
logOptions = &git.LogOptions{From: lastTagHash.Hash()}
|
||||
}
|
||||
excludeIter, err := g.Repository.Log(logOptions)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get git log %w", err)
|
||||
}
|
||||
|
||||
seen := map[plumbing.Hash]struct{}{}
|
||||
err = excludeIter.ForEach(func(c *object.Commit) error {
|
||||
seen[c.Hash] = struct{}{}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var isValid object.CommitFilter = func(commit *object.Commit) bool {
|
||||
_, ok := seen[commit.Hash]
|
||||
return !ok && len(commit.ParentHashes) < 2
|
||||
}
|
||||
|
||||
startCommit, err := g.Repository.CommitObject(ref.Hash())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cIter := object.NewFilterCommitIter(startCommit, &isValid, nil)
|
||||
|
||||
commits := make(map[string]shared.Commit)
|
||||
var foundEnd bool
|
||||
|
||||
err = cIter.ForEach(func(c *object.Commit) error {
|
||||
|
||||
if c.Hash.String() == lastTagHash {
|
||||
log.Debugf("Found commit with hash %s, will stop here", c.Hash.String())
|
||||
foundEnd = true
|
||||
return storer.ErrStop
|
||||
}
|
||||
|
||||
if !foundEnd {
|
||||
log.Tracef("Found commit with hash %s", c.Hash.String())
|
||||
log.Debugf("Found commit with hash %s from %s", c.Hash.String(), c.Author.Name)
|
||||
commits[c.Hash.String()] = shared.Commit{
|
||||
Message: c.Message,
|
||||
Author: c.Committer.Name,
|
||||
Author: c.Author.Name,
|
||||
Hash: c.Hash.String(),
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "Could not read commits, check git clone depth in your ci")
|
||||
}
|
||||
|
||||
26
internal/integrations/integrations.go
Normal file
26
internal/integrations/integrations.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"github.com/Nightapes/go-semantic-release/internal/shared"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
)
|
||||
|
||||
// Integrations struct
|
||||
type Integrations struct {
|
||||
version *shared.ReleaseVersion
|
||||
config *config.Integrations
|
||||
}
|
||||
|
||||
func New(config *config.Integrations, version *shared.ReleaseVersion) *Integrations {
|
||||
return &Integrations{
|
||||
config: config,
|
||||
version: version,
|
||||
}
|
||||
}
|
||||
|
||||
func (i Integrations) Run() error {
|
||||
if i.config.NPM.Enabled {
|
||||
return i.updateNPM()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
28
internal/integrations/npm.go
Normal file
28
internal/integrations/npm.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
"github.com/tidwall/sjson"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func (i *Integrations) updateNPM() error {
|
||||
|
||||
npmConfig := i.config.NPM
|
||||
if npmConfig.Path == "" {
|
||||
npmConfig.Path = "./package.json"
|
||||
}
|
||||
|
||||
log.Debugf("Set version %s to %s", i.version.Next.Version, npmConfig.Path)
|
||||
data, err := ioutil.ReadFile(npmConfig.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
newData, err := sjson.Set(string(data), "version", i.version.Next.Version)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return ioutil.WriteFile(npmConfig.Path, []byte(newData), 0777)
|
||||
}
|
||||
62
internal/integrations/npm_test.go
Normal file
62
internal/integrations/npm_test.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package integrations
|
||||
|
||||
import (
|
||||
"github.com/Masterminds/semver"
|
||||
"github.com/Nightapes/go-semantic-release/internal/shared"
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIntegrations_updateNPM(t *testing.T) {
|
||||
file, err := ioutil.TempFile("", "package")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer os.Remove(file.Name())
|
||||
|
||||
err = ioutil.WriteFile(file.Name(), []byte(`{
|
||||
"name": "test",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"nx": "nx"
|
||||
}
|
||||
}`), 0777)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
testVersion, err := semver.NewVersion("1.2.0")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
i := New(&config.Integrations{NPM: config.IntegrationNPM{
|
||||
Enabled: true,
|
||||
Path: file.Name(),
|
||||
}}, &shared.ReleaseVersion{
|
||||
Next: shared.ReleaseVersionEntry{
|
||||
Version: testVersion,
|
||||
},
|
||||
})
|
||||
|
||||
assert.NoError(t, i.updateNPM())
|
||||
updatedFile, err := ioutil.ReadFile(file.Name())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
assert.Equal(t, `{
|
||||
"name": "test",
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"nx": "nx"
|
||||
}
|
||||
}`, string(updatedFile))
|
||||
|
||||
}
|
||||
@@ -54,10 +54,13 @@ func New(c *config.GitHubProvider, checkConfig bool) (*Client, error) {
|
||||
if c.CustomURL == "" {
|
||||
client = github.NewClient(httpClient)
|
||||
} else {
|
||||
if client, err = github.NewEnterpriseClient(c.CustomURL, c.CustomURL+"/api/v3/", httpClient); err != nil {
|
||||
// v25.0 of google github does not append prefixes for base and upload URLs
|
||||
if client, err = github.NewEnterpriseClient(c.CustomURL+"/api/v3/", c.CustomURL+"/api/uploads/", httpClient); err != nil {
|
||||
return &Client{}, err
|
||||
}
|
||||
baseURL = c.CustomURL
|
||||
// note: do not append / to end of the url since all the url constructions using this
|
||||
// assume no trailing /
|
||||
baseURL = c.CustomURL + "/api/v3"
|
||||
}
|
||||
return &Client{
|
||||
config: c,
|
||||
@@ -91,7 +94,7 @@ func (g *Client) CreateRelease(releaseVersion *shared.ReleaseVersion, generatedC
|
||||
func (g *Client) makeRelease(releaseVersion *shared.ReleaseVersion, generatedChangelog *shared.GeneratedChangelog) error {
|
||||
|
||||
tagPrefix := config.DefaultTagPrefix
|
||||
if g.config.TagPrefix != nil{
|
||||
if g.config.TagPrefix != nil {
|
||||
tagPrefix = *g.config.TagPrefix
|
||||
}
|
||||
tag := tagPrefix + releaseVersion.Next.Version.String()
|
||||
|
||||
@@ -136,7 +136,7 @@ func TestGetCommitURL(t *testing.T) {
|
||||
client, _ := New(&testOject.config, false)
|
||||
actualURL := client.GetCommitURL()
|
||||
if testOject.config.CustomURL != "" {
|
||||
expectedURL := fmt.Sprintf("%s/%s/%s/commit/{{hash}}", testOject.config.CustomURL, testOject.config.User, testOject.config.Repo)
|
||||
expectedURL := fmt.Sprintf("%s/api/v3/%s/%s/commit/{{hash}}", testOject.config.CustomURL, testOject.config.User, testOject.config.Repo)
|
||||
assert.EqualValues(t, expectedURL, actualURL)
|
||||
|
||||
} else {
|
||||
@@ -154,7 +154,7 @@ func TestGetCompareURL(t *testing.T) {
|
||||
client, _ := New(&testOject.config, false)
|
||||
actualURL := client.GetCompareURL("1", "2")
|
||||
if testOject.config.CustomURL != "" {
|
||||
expectedURL := fmt.Sprintf("%s/%s/%s/compare/%s...%s", testOject.config.CustomURL, testOject.config.User, testOject.config.Repo, "1", "2")
|
||||
expectedURL := fmt.Sprintf("%s/api/v3/%s/%s/compare/%s...%s", testOject.config.CustomURL, testOject.config.User, testOject.config.Repo, "1", "2")
|
||||
assert.EqualValues(t, expectedURL, actualURL)
|
||||
|
||||
} else {
|
||||
|
||||
@@ -22,29 +22,29 @@ func TestGetCommitURL(t *testing.T) {
|
||||
os.Setenv("GITLAB_ACCESS_TOKEN", "XXX")
|
||||
defer os.Unsetenv("GITLAB_ACCESS_TOKEN")
|
||||
client, err := New(&config.GitLabProvider{
|
||||
CustomURL: "https://localhost/",
|
||||
CustomURL: "https://127.0.0.1/",
|
||||
Repo: "test/test",
|
||||
}, true)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "https://localhost/test/test/commit/{{hash}}", client.GetCommitURL())
|
||||
assert.Equal(t, "https://127.0.0.1/test/test/commit/{{hash}}", client.GetCommitURL())
|
||||
}
|
||||
|
||||
func TestGetCompareURL(t *testing.T) {
|
||||
os.Setenv("GITLAB_ACCESS_TOKEN", "XXX")
|
||||
defer os.Unsetenv("GITLAB_ACCESS_TOKEN")
|
||||
client, err := New(&config.GitLabProvider{
|
||||
CustomURL: "https://localhost/",
|
||||
CustomURL: "https://127.0.0.1/",
|
||||
Repo: "test/test",
|
||||
}, true)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "https://localhost/test/test/compare/1.0.0...1.0.1", client.GetCompareURL("1.0.0", "1.0.1"))
|
||||
assert.Equal(t, "https://127.0.0.1/test/test/compare/1.0.0...1.0.1", client.GetCompareURL("1.0.0", "1.0.1"))
|
||||
}
|
||||
|
||||
func TestValidateConfig_EmptyRepro(t *testing.T) {
|
||||
os.Setenv("GITLAB_ACCESS_TOKEN", "XXX")
|
||||
defer os.Unsetenv("GITLAB_ACCESS_TOKEN")
|
||||
_, err := New(&config.GitLabProvider{
|
||||
CustomURL: "https://localhost/",
|
||||
CustomURL: "https://127.0.0.1/",
|
||||
}, true)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
@@ -53,7 +53,7 @@ func TestValidateConfig_DefaultURL(t *testing.T) {
|
||||
os.Setenv("GITLAB_ACCESS_TOKEN", "XXX")
|
||||
defer os.Unsetenv("GITLAB_ACCESS_TOKEN")
|
||||
config := &config.GitLabProvider{
|
||||
Repo: "localhost/test",
|
||||
Repo: "127.0.0.1/test",
|
||||
}
|
||||
_, err := New(config, true)
|
||||
assert.NoError(t, err)
|
||||
@@ -64,13 +64,13 @@ func TestValidateConfig_CustomURL(t *testing.T) {
|
||||
os.Setenv("GITLAB_ACCESS_TOKEN", "XXX")
|
||||
defer os.Unsetenv("GITLAB_ACCESS_TOKEN")
|
||||
config := &config.GitLabProvider{
|
||||
Repo: "/localhost/test/",
|
||||
CustomURL: "https://localhost/",
|
||||
Repo: "/127.0.0.1/test/",
|
||||
CustomURL: "https://127.0.0.1/",
|
||||
}
|
||||
_, err := New(config, true)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "https://localhost", config.CustomURL)
|
||||
assert.Equal(t, "localhost/test", config.Repo)
|
||||
assert.Equal(t, "https://127.0.0.1", config.CustomURL)
|
||||
assert.Equal(t, "127.0.0.1/test", config.Repo)
|
||||
}
|
||||
|
||||
func TestCreateRelease(t *testing.T) {
|
||||
|
||||
@@ -59,7 +59,7 @@ func TestIsValidResult(t *testing.T) {
|
||||
assert.NoError(t, util.IsValidResult(&http.Response{StatusCode: 202}))
|
||||
assert.NoError(t, util.IsValidResult(&http.Response{StatusCode: 204}))
|
||||
|
||||
u, err := url.Parse("https://localhost")
|
||||
u, err := url.Parse("https://127.0.0.1")
|
||||
assert.NoError(t, err)
|
||||
assert.Error(t, util.IsValidResult(&http.Response{StatusCode: 500, Request: &http.Request{
|
||||
Method: "POST",
|
||||
|
||||
@@ -37,13 +37,22 @@ type ChangelogTemplateConfig struct {
|
||||
type AnalyzedCommit struct {
|
||||
Commit Commit `yaml:"commit"`
|
||||
ParsedMessage string `yaml:"parsedMessage"`
|
||||
Scope Scope `yaml:"scope"`
|
||||
ParsedBreakingChangeMessage string `yaml:"parsedBreakingChangeMessage"`
|
||||
Tag string `yaml:"tag"`
|
||||
TagString string `yaml:"tagString"`
|
||||
Scope Scope `yaml:"scope"`
|
||||
Subject string `yaml:"subject"`
|
||||
MessageBlocks map[string][]MessageBlock `yaml:"messageBlocks"`
|
||||
IsBreaking bool `yaml:"isBreaking"`
|
||||
Print bool `yaml:"print"`
|
||||
}
|
||||
|
||||
// MessageBlock represents a block in the body section of a commit message
|
||||
type MessageBlock struct {
|
||||
Label string `yaml:"label"`
|
||||
Content string `yaml:"content"`
|
||||
}
|
||||
|
||||
//Scope of the commit, like feat, fix,..
|
||||
type Scope string
|
||||
|
||||
|
||||
@@ -13,11 +13,18 @@ const (
|
||||
DefaultTagPrefix = "v"
|
||||
)
|
||||
|
||||
// AnalyzerConfig struct
|
||||
type AnalyzerConfig struct {
|
||||
TokenSeparators []string `yaml:"tokenSeparators"`
|
||||
}
|
||||
|
||||
// ChangelogConfig struct
|
||||
type ChangelogConfig struct {
|
||||
PrintAll bool `yaml:"printAll,omitempty"`
|
||||
TemplateTitle string `yaml:"title,omitempty"`
|
||||
TemplatePath string `yaml:"templatePath,omitempty"`
|
||||
ShowBodyAsHeader bool `yaml:"showBodyAsHeader,omitempty"`
|
||||
ShowAuthors bool `yaml:"showAuthors,omitempty"`
|
||||
Docker ChangelogDocker `yaml:"docker,omitempty"`
|
||||
NPM ChangelogNPM `yaml:"npm,omitempty"`
|
||||
}
|
||||
@@ -30,8 +37,8 @@ type ChangelogDocker struct {
|
||||
|
||||
//ChangelogNPM type struct
|
||||
type ChangelogNPM struct {
|
||||
YARN bool `yaml:"latest"`
|
||||
Repository string `yaml:"repository"`
|
||||
PackageName string `yaml:"name"`
|
||||
}
|
||||
|
||||
//Asset type struct
|
||||
@@ -79,10 +86,22 @@ type Checksum struct {
|
||||
Algorithm string `yaml:"algorithm"`
|
||||
}
|
||||
|
||||
// Checksum struct
|
||||
type Integrations struct {
|
||||
NPM IntegrationNPM `yaml:"npm"`
|
||||
}
|
||||
|
||||
// Checksum struct
|
||||
type IntegrationNPM struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Path string `yaml:"path"`
|
||||
}
|
||||
|
||||
// ReleaseConfig struct
|
||||
type ReleaseConfig struct {
|
||||
CommitFormat string `yaml:"commitFormat"`
|
||||
Branch map[string]string `yaml:"branch"`
|
||||
Analyzer AnalyzerConfig `yaml:"analyzer"`
|
||||
Changelog ChangelogConfig `yaml:"changelog,omitempty"`
|
||||
Release string `yaml:"release,omitempty"`
|
||||
GitHubProvider GitHubProvider `yaml:"github,omitempty"`
|
||||
@@ -91,6 +110,7 @@ type ReleaseConfig struct {
|
||||
Assets []Asset `yaml:"assets"`
|
||||
Checksum Checksum `yaml:"checksum,omitempty"`
|
||||
Hooks Hooks `yaml:"hooks"`
|
||||
Integrations Integrations `yaml:"integrations"`
|
||||
ReleaseTitle string `yaml:"title"`
|
||||
IsPreRelease bool
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ github:
|
||||
Compress: false}},
|
||||
ReleaseTitle: "go-semantic-release release",
|
||||
IsPreRelease: false,
|
||||
Analyzer: config.AnalyzerConfig{TokenSeparators: []string{}},
|
||||
}, result)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package semanticrelease
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"fmt"
|
||||
"github.com/go-git/go-git/v5/plumbing"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/Nightapes/go-semantic-release/internal/integrations"
|
||||
|
||||
"github.com/Masterminds/semver"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
@@ -39,7 +45,7 @@ func New(c *config.ReleaseConfig, repository string, checkConfig bool) (*Semanti
|
||||
return nil, err
|
||||
}
|
||||
|
||||
analyzer, err := analyzer.New(c.CommitFormat, c.Changelog)
|
||||
analyzer, err := analyzer.New(c.CommitFormat, c.Analyzer, c.Changelog)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -73,9 +79,9 @@ func (s *SemanticRelease) GetCIProvider() (*ci.ProviderConfig, error) {
|
||||
}
|
||||
|
||||
// GetNextVersion from .version or calculate new from commits
|
||||
func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool) (*shared.ReleaseVersion, error) {
|
||||
func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool, from string) (*shared.ReleaseVersion, error) {
|
||||
log.Debugf("Ignore .version file if exits, %t", force)
|
||||
if !force {
|
||||
if !force && from == "" {
|
||||
releaseVersion, err := cache.Read(s.repository)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -86,10 +92,21 @@ func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool
|
||||
}
|
||||
}
|
||||
|
||||
lastVersion, lastVersionHash, err := s.gitUtil.GetLastVersion()
|
||||
var lastVersion *semver.Version
|
||||
var lastVersionHash *plumbing.Reference
|
||||
var err error
|
||||
|
||||
if from == "" {
|
||||
lastVersion, lastVersionHash, err = s.gitUtil.GetLastVersion()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
lastVersion, lastVersionHash, err = s.gitUtil.GetVersion(from)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
firstRelease := false
|
||||
|
||||
@@ -101,7 +118,7 @@ func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool
|
||||
|
||||
commits, err := s.gitUtil.GetCommits(lastVersionHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("could not get commits %w", err)
|
||||
}
|
||||
|
||||
log.Debugf("Found %d commits till last release", len(commits))
|
||||
@@ -130,12 +147,15 @@ func (s *SemanticRelease) GetNextVersion(provider *ci.ProviderConfig, force bool
|
||||
Version: &newVersion,
|
||||
},
|
||||
Last: shared.ReleaseVersionEntry{
|
||||
Commit: lastVersionHash,
|
||||
Commit: "",
|
||||
Version: lastVersion,
|
||||
},
|
||||
Branch: provider.Branch,
|
||||
Commits: analyzedCommits,
|
||||
}
|
||||
if lastVersionHash != nil {
|
||||
releaseVersion.Last.Commit = lastVersionHash.Hash().String()
|
||||
}
|
||||
|
||||
if firstRelease {
|
||||
releaseVersion.Last.Version, _ = semver.NewVersion("0.0.0")
|
||||
@@ -170,7 +190,7 @@ func (s *SemanticRelease) SetVersion(provider *ci.ProviderConfig, version string
|
||||
Version: newVersion,
|
||||
},
|
||||
Last: shared.ReleaseVersionEntry{
|
||||
Commit: lastVersionHash,
|
||||
Commit: lastVersionHash.Hash().String(),
|
||||
Version: lastVersion,
|
||||
},
|
||||
Branch: provider.Branch,
|
||||
@@ -180,7 +200,7 @@ func (s *SemanticRelease) SetVersion(provider *ci.ProviderConfig, version string
|
||||
// GetChangelog from last version till now
|
||||
func (s *SemanticRelease) GetChangelog(releaseVersion *shared.ReleaseVersion) (*shared.GeneratedChangelog, error) {
|
||||
c := changelog.New(s.config, s.analyzer.GetRules(), time.Now())
|
||||
return c.GenerateChanglog(shared.ChangelogTemplateConfig{
|
||||
return c.GenerateChangelog(shared.ChangelogTemplateConfig{
|
||||
Version: releaseVersion.Next.Version.String(),
|
||||
Hash: releaseVersion.Last.Commit,
|
||||
CommitURL: s.releaser.GetCommitURL(),
|
||||
@@ -189,8 +209,81 @@ func (s *SemanticRelease) GetChangelog(releaseVersion *shared.ReleaseVersion) (*
|
||||
}
|
||||
|
||||
// WriteChangeLog writes changelog content to the given file
|
||||
func (s *SemanticRelease) WriteChangeLog(changelogContent, file string) error {
|
||||
return ioutil.WriteFile(file, []byte(changelogContent), 0644)
|
||||
func (s *SemanticRelease) WriteChangeLog(changelogContent, file string, overwrite bool, maxChangelogFileSize int64) error {
|
||||
info, err := os.Stat(file)
|
||||
if overwrite || err != nil {
|
||||
return os.WriteFile(file, []byte(changelogContent), 0644)
|
||||
}
|
||||
|
||||
if bytesToMB(info.Size()) >= float64(maxChangelogFileSize) {
|
||||
err := moveExistingChangelogFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return prependToFile(changelogContent, file)
|
||||
}
|
||||
|
||||
func bytesToMB(bytes int64) float64 {
|
||||
return float64(bytes) / 1024 / 1024 / 1024
|
||||
}
|
||||
|
||||
func moveExistingChangelogFile(file string) error {
|
||||
filenameSeparated := strings.Split(filepath.Base(file), ".")
|
||||
|
||||
// check if file had several "." included.
|
||||
// if yes the filename will be separated like this: "my.file.name", ".md"
|
||||
if len(filenameSeparated) > 2 {
|
||||
separatedFilenameWithExtension := make([]string, 0)
|
||||
separatedFilenameWithExtension = append(separatedFilenameWithExtension, strings.Join(filenameSeparated[:len(filenameSeparated)-1], "."))
|
||||
separatedFilenameWithExtension = append(separatedFilenameWithExtension, filenameSeparated[len(filenameSeparated)-1])
|
||||
filenameSeparated = separatedFilenameWithExtension
|
||||
}
|
||||
|
||||
var newFileName string
|
||||
counter := 1
|
||||
for {
|
||||
newFileName = buildNewFileName(filenameSeparated, counter)
|
||||
if _, err := os.Stat(newFileName); err != nil {
|
||||
break
|
||||
}
|
||||
counter++
|
||||
}
|
||||
|
||||
content, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = os.WriteFile(newFileName, content, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = os.Create(file)
|
||||
return err
|
||||
}
|
||||
|
||||
func buildNewFileName(currentFileNameSeparated []string, counter int) string {
|
||||
if len(currentFileNameSeparated) == 1 {
|
||||
return fmt.Sprintf("%s-%d", currentFileNameSeparated[0], counter)
|
||||
}
|
||||
|
||||
fileNameWithoutExtension := strings.Join(currentFileNameSeparated[:len(currentFileNameSeparated)-1], ".")
|
||||
fileExtension := currentFileNameSeparated[len(currentFileNameSeparated)-1]
|
||||
return fmt.Sprintf("%s-%d.%s", fileNameWithoutExtension, counter, fileExtension)
|
||||
}
|
||||
|
||||
func prependToFile(newChangelogContent, file string) error {
|
||||
currentContent, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
content := make([]byte, 0)
|
||||
content = append(content, []byte(newChangelogContent)...)
|
||||
content = append(content, []byte("\n---\n\n")...)
|
||||
content = append(content, currentContent...)
|
||||
return os.WriteFile(file, content, 0644)
|
||||
}
|
||||
|
||||
// Release publish release to provider
|
||||
@@ -209,7 +302,7 @@ func (s *SemanticRelease) Release(provider *ci.ProviderConfig, force bool) error
|
||||
return err
|
||||
}
|
||||
|
||||
releaseVersion, err := s.GetNextVersion(provider, force)
|
||||
releaseVersion, err := s.GetNextVersion(provider, force, "")
|
||||
if err != nil {
|
||||
log.Debugf("Could not get next version")
|
||||
return err
|
||||
@@ -226,6 +319,12 @@ func (s *SemanticRelease) Release(provider *ci.ProviderConfig, force bool) error
|
||||
return err
|
||||
}
|
||||
|
||||
integrations := integrations.New(&s.config.Integrations, releaseVersion)
|
||||
if err := integrations.Run(); err != nil {
|
||||
log.Debugf("Error during integrations run")
|
||||
return err
|
||||
}
|
||||
|
||||
hook := hooks.New(s.config, releaseVersion)
|
||||
if err := hook.PreRelease(); err != nil {
|
||||
log.Debugf("Error during pre release hook")
|
||||
|
||||
83
pkg/semanticrelease/semantic-release_test.go
Normal file
83
pkg/semanticrelease/semantic-release_test.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package semanticrelease
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/Nightapes/go-semantic-release/pkg/config"
|
||||
)
|
||||
|
||||
func TestSemanticRelease_WriteChangeLog(t *testing.T) {
|
||||
|
||||
type args struct {
|
||||
changelogContent string
|
||||
file string
|
||||
overwrite bool
|
||||
maxChangelogFileSize int64
|
||||
}
|
||||
tests := []struct {
|
||||
config *config.ReleaseConfig
|
||||
name string
|
||||
args args
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "MoveExisting",
|
||||
args: args{
|
||||
changelogContent: "go-semantic-release-rocks!",
|
||||
file: "test1.changelog.md",
|
||||
overwrite: false,
|
||||
maxChangelogFileSize: 0,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "ValidWithOverwrite",
|
||||
args: args{
|
||||
changelogContent: "go-semantic-release-rocks!",
|
||||
file: "test2.changelog.md",
|
||||
overwrite: true,
|
||||
maxChangelogFileSize: 0,
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
_, err := os.Create(tt.args.file)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
releaser := &SemanticRelease{}
|
||||
if err := releaser.WriteChangeLog(tt.args.changelogContent, tt.args.file, tt.args.overwrite, tt.args.maxChangelogFileSize); (err != nil) != tt.wantErr {
|
||||
t.Errorf("WriteChangeLog() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
|
||||
name := strings.Join(strings.Split(tt.args.file, ".")[:len(strings.Split(tt.args.file, "."))-1], ".")
|
||||
|
||||
files, err := filepath.Glob("./" + name + "*")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if !tt.wantErr && !tt.args.overwrite && tt.args.maxChangelogFileSize == 0 && len(files) <= 1 {
|
||||
t.Errorf("WriteChangelog() = should create a copy of the existing changelog file")
|
||||
}
|
||||
|
||||
if !tt.wantErr && tt.args.overwrite && len(files) > 1 {
|
||||
t.Errorf("WriteChangelog() = should not create a copy of the changelog file")
|
||||
}
|
||||
|
||||
for _, i := range files {
|
||||
err := os.Remove(i)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user