Skip to content

Commit

Permalink
Merge pull request #48 from jkawamoto/hotfix/v0.7.2
Browse files Browse the repository at this point in the history
Hotfix/v0.7.2
  • Loading branch information
jkawamoto committed Apr 11, 2024
2 parents 26ab6d7 + 231c4be commit 5d950ab
Show file tree
Hide file tree
Showing 17 changed files with 201 additions and 265 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.1
current_version = 0.7.2
commit = True

[bumpversion:file:README.md]
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/test.yaml → .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,21 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.20"
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit hook
uses: pre-commit/action@v3.0.1
- name: Run tests
run: go test -race -coverprofile=coverage.out -covermode=atomic -v ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
- name: Run lints
run: pre-commit run --all-files
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
windows:
uses: codecov/codecov-action@v4
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.20"
- name: Run tests
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,32 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ">=1.20"
- name: Run tests
run: go test -v ./...
- uses: goreleaser/goreleaser-action@v4
- uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}

merge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: develop
- name: Merge the new version into develop
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch --tags origin
git merge ${REF##*/}
git push
env:
REF: ${{ github.event.push.ref }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-json
Expand All @@ -12,6 +12,6 @@ repos:
- id: trailing-whitespace
- id: detect-private-key
- repo: https://github.com/golangci/golangci-lint
rev: v1.52.2
rev: v1.57.2
hooks:
- id: golangci-lint
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# A Pixeldrain client
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
[![Go application](https://github.com/jkawamoto/go-pixeldrain/actions/workflows/test.yaml/badge.svg)](https://github.com/jkawamoto/go-pixeldrain/actions/workflows/test.yaml)
[![Go application](https://github.com/jkawamoto/go-pixeldrain/actions/workflows/ci.yaml/badge.svg)](https://github.com/jkawamoto/go-pixeldrain/actions/workflows/ci.yaml)
[![Go Reference](https://pkg.go.dev/badge/github.com/jkawamoto/go-pixeldrain.svg)](https://pkg.go.dev/github.com/jkawamoto/go-pixeldrain)
[![codecov](https://codecov.io/gh/jkawamoto/go-pixeldrain/branch/master/graph/badge.svg?token=ppX3MVIqWA)](https://codecov.io/gh/jkawamoto/go-pixeldrain)
[![Release](https://img.shields.io/badge/release-0.7.1-brightgreen.svg)](https://github.com/jkawamoto/go-pixeldrain/releases/tag/v0.7.1)
[![Release](https://img.shields.io/badge/release-0.7.2-brightgreen.svg)](https://github.com/jkawamoto/go-pixeldrain/releases/tag/v0.7.2)


## Usage
Expand Down Expand Up @@ -95,7 +95,7 @@ To build the newest version, use go get command:
$ go get github.com/jkawamoto/go-pixeldrain
```

Otherwise, compiled binaries are also available in [Github](https://github.com/jkawamoto/go-pixeldrain/releases).
Otherwise, compiled binaries are also available in [GitHub](https://github.com/jkawamoto/go-pixeldrain/releases).


## License
Expand Down
5 changes: 5 additions & 0 deletions client/user/list_file_lists_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions client/user/list_files_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions cmd/pd/command/download_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// download_test.go
//
// Copyright (c) 2018-2023 Junpei Kawamoto
// Copyright (c) 2018-2024 Junpei Kawamoto
//
// This software is released under the MIT License.
//
Expand All @@ -11,6 +11,7 @@ package command
import (
"bytes"
"context"
"errors"
"flag"
"io"
"os"
Expand Down Expand Up @@ -276,7 +277,8 @@ func TestCmdDownload(t *testing.T) {

err = CmdDownload(c)
if err != nil || tc.exit != 0 {
if e, ok := err.(cli.ExitCoder); !ok {
var e cli.ExitCoder
if !errors.As(err, &e) {
t.Errorf("expect an ExitCoder, got %v", err)
} else if e.ExitCode() != tc.exit {
t.Errorf("expect %v, got %v", tc.exit, e.ExitCode())
Expand Down
1 change: 0 additions & 1 deletion cmd/pd/command/mock/mock_service.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion cmd/pd/command/upload.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// upload.go
//
// Copyright (c) 2018-2023 Junpei Kawamoto
// Copyright (c) 2018-2024 Junpei Kawamoto
//
// This software is released under the MIT License.
//
Expand Down Expand Up @@ -189,6 +189,14 @@ func parseRecipientFile(name string) (_ []age.Recipient, err error) {
}

func parseArgument(arg string) (path string, name string, _ error) {
if strings.HasPrefix(arg, "-:") {
name = strings.TrimPrefix(arg, "-:")
if strings.HasPrefix(name, "\"") && strings.HasSuffix(name, "\"") {
name = name[1 : len(name)-1]
}
return "-", name, nil
}

volume := filepath.VolumeName(arg)
arg = strings.TrimPrefix(arg, volume)

Expand Down
18 changes: 15 additions & 3 deletions cmd/pd/command/upload_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// upload_test.go
//
// Copyright (c) 2018-2023 Junpei Kawamoto
// Copyright (c) 2018-2024 Junpei Kawamoto
//
// This software is released under the MIT License.
//
Expand All @@ -11,6 +11,7 @@ package command
import (
"bytes"
"context"
"errors"
"flag"
"io"
"os"
Expand Down Expand Up @@ -460,10 +461,11 @@ func TestUpload(t *testing.T) {

err = CmdUpload(c)
if err != nil || tc.exit != 0 {
if e, ok := err.(cli.ExitCoder); !ok {
var e cli.ExitCoder
if !errors.As(err, &e) {
t.Errorf("expect an ExitCoder, got %v", err)
} else if e.ExitCode() != tc.exit {
t.Errorf("expect %v, got %v", tc.exit, e.ExitCode())
t.Errorf("expect %v, got %v (%v)", tc.exit, e.ExitCode(), e)
}
}

Expand All @@ -489,6 +491,11 @@ func Test_parseArgument(t *testing.T) {
wantPath: "simple",
wantName: "case",
},
{
arg: "-:stdin",
wantPath: "-",
wantName: "stdin",
},
{
arg: "\"quoted path only\"",
wantPath: "quoted path only",
Expand All @@ -499,6 +506,11 @@ func Test_parseArgument(t *testing.T) {
wantPath: "quoted path only",
wantName: "quoted name",
},
{
arg: "-:\"stdin\"",
wantPath: "-",
wantName: "stdin",
},
}
for _, tt := range tests {
t.Run(tt.arg, func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/pd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const (
// Name defines the basename of this program.
Name = "pd"
// Version defines current version number.
Version = "0.7.1"
Version = "0.7.2"
)

// commandNotFound shows error message and exit when a given command is not found.
Expand Down
4 changes: 2 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// doc.go
//
// Copyright (c) 2018-2023 Junpei Kawamoto
// Copyright (c) 2018-2024 Junpei Kawamoto
//
// This software is released under the MIT License.
//
// http://opensource.org/licenses/mit-license.php

// Package pixeldrain provides a Pixeldrain client.
//
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4 generate client -f ./openapi.yaml -t .
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.30.5 generate client -f ./openapi.yaml -t .
package pixeldrain
64 changes: 34 additions & 30 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,53 +1,57 @@
module github.com/jkawamoto/go-pixeldrain

go 1.20
go 1.21

toolchain go1.22.1

require (
filippo.io/age v1.1.1
github.com/AlecAivazis/survey/v2 v2.3.6
github.com/cheggaaa/pb/v3 v3.1.2
github.com/go-openapi/errors v0.20.3
github.com/go-openapi/runtime v0.25.0
github.com/go-openapi/strfmt v0.21.7
github.com/go-openapi/swag v0.22.3
github.com/go-openapi/validate v0.22.1
github.com/AlecAivazis/survey/v2 v2.3.7
github.com/cheggaaa/pb/v3 v3.1.5
github.com/go-openapi/errors v0.22.0
github.com/go-openapi/runtime v0.28.0
github.com/go-openapi/strfmt v0.23.0
github.com/go-openapi/swag v0.23.0
github.com/go-openapi/validate v0.24.0
github.com/golang/mock v1.6.0
github.com/urfave/cli/v2 v2.25.1
github.com/urfave/cli/v2 v2.27.1
)

require (
filippo.io/edwards25519 v1.0.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/VividCortex/ewma v1.2.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.21.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/spec v0.20.8 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/jsonreference v0.21.0 // indirect
github.com/go-openapi/loads v0.22.0 // indirect
github.com/go-openapi/spec v0.21.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
go.mongodb.org/mongo-driver v1.11.4 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect
golang.org/x/crypto v0.8.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/term v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

0 comments on commit 5d950ab

Please sign in to comment.