3 Commits

Author SHA1 Message Date
Motiejus Jakštys
6d24d0da7a replace io/ioutil with os 2023-01-03 16:00:34 +02:00
Motiejus Jakštys
d3efb410d0 make: fix clean target 2022-08-29 18:02:22 +03:00
1c46fb8617 release: a better changelog 2022-06-09 14:28:39 +03:00
3 changed files with 8 additions and 9 deletions

View File

@@ -26,4 +26,4 @@ coverage.html: coverage.out
.PHONY: clean
clean:
rm -f undocker-*-v* coverage.html
rm -f undocker coverage.html

View File

@@ -4,7 +4,6 @@ import (
"bytes"
"errors"
"io"
"io/ioutil"
"os"
"path/filepath"
"regexp"
@@ -28,7 +27,7 @@ func TestExecute(t *testing.T) {
infile: "t10-in.txt",
fixture: func(t *testing.T, dir string) {
fname := filepath.Join(dir, "t10-in.txt")
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
if err := os.WriteFile(fname, _foo, 0644); err != nil {
t.Fatalf("unexpected error: %v", err)
}
},
@@ -39,7 +38,7 @@ func TestExecute(t *testing.T) {
infile: "t20-in.txt",
fixture: func(t *testing.T, dir string) {
fname := filepath.Join(dir, "t20-in.txt")
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
if err := os.WriteFile(fname, _foo, 0644); err != nil {
t.Fatalf("unexpected error: %v", err)
}
},
@@ -50,7 +49,7 @@ func TestExecute(t *testing.T) {
infile: "t30-in.txt",
fixture: func(t *testing.T, dir string) {
fname := filepath.Join(dir, "t30-in.txt")
if err := ioutil.WriteFile(fname, _foo, 0644); err != nil {
if err := os.WriteFile(fname, _foo, 0644); err != nil {
t.Fatalf("unexpected error: %v", err)
}
},
@@ -122,7 +121,7 @@ func TestExecute(t *testing.T) {
if tt.outfile == "-" {
out = stdout.Bytes()
} else {
out, err = ioutil.ReadFile(tt.outfile)
out, err = os.ReadFile(tt.outfile)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}

View File

@@ -6,8 +6,8 @@ _err(){ >&2 echo "ERROR: $*"; exit 1; }
git status --porcelain | grep -q "" &&
_err "working tree is dirty, commit your changes first."
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?$ ]] || \
_err "arg1 accepts the following formats: v1.0 v1.0.0"
[[ "$1" =~ ^v([0-9]+)\.([0-9]+)(\.([0-9]+))?(-rc([0-9]+))?$ ]] || \
_err "arg1 accepts the following formats: v1.0 v1.0.0 v1.0-rc1 v1.0.1-rc1"
git tag | grep -q "^$1$" &&
_err "tag $1 already exists"
@@ -21,5 +21,5 @@ last_tag=$(git tag | tail -1)
echo undocker "$1"
echo
echo Changelog since "$last_tag":
git log --pretty=format:"- [%cn] %s" "$last_tag"..HEAD
git log --pretty=format:"- [%an] %s" "$last_tag"..HEAD
} | git tag -u motiejus@jakstys.lt -F - "$1"