diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9b28452..fa0bb03 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,9 +12,9 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: ^1.17 + go-version: ^1.18 - name: golangci-lint - uses: golangci/golangci-lint-action@v2 + uses: golangci/golangci-lint-action@v3 with: # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. version: latest diff --git a/.github/workflows/vulns.yml b/.github/workflows/vulns.yml index a96d6e3..19b2036 100644 --- a/.github/workflows/vulns.yml +++ b/.github/workflows/vulns.yml @@ -12,14 +12,9 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v2 with: - go-version: ^1.17 + go-version: ^1.18 - name: install depm - run: | - pushd $RUNNER_TEMP - curl -Lfs -o depm.tar.gz https://github.com/spiegel-im-spiegel/depm/releases/download/v0.4.4/depm_0.4.4_Linux_64bit.tar.gz - sudo tar -xzf depm.tar.gz - sudo mv depm /usr/local/bin/depm - popd + run: go install github.com/goark/depm@latest - name: WriteGoList run: depm list --json > go.list - name: Nancy diff --git a/README.md b/README.md index fd63a88..dad62fd 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # [koyomi] -- 日本のこよみ -[![check vulns](https://github.com/spiegel-im-spiegel/koyomi/workflows/vulns/badge.svg)](https://github.com/spiegel-im-spiegel/koyomi/actions) -[![lint status](https://github.com/spiegel-im-spiegel/koyomi/workflows/lint/badge.svg)](https://github.com/spiegel-im-spiegel/koyomi/actions) -[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/spiegel-im-spiegel/koyomi/master/LICENSE) -[![GitHub release](https://img.shields.io/github/release/spiegel-im-spiegel/koyomi.svg)](https://github.com/spiegel-im-spiegel/koyomi/releases/latest) +[![check vulns](https://github.com/goark/koyomi/workflows/vulns/badge.svg)](https://github.com/goark/koyomi/actions) +[![lint status](https://github.com/goark/koyomi/workflows/lint/badge.svg)](https://github.com/goark/koyomi/actions) +[![GitHub license](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/goark/koyomi/master/LICENSE) +[![GitHub release](https://img.shields.io/github/release/goark/koyomi.svg)](https://github.com/goark/koyomi/releases/latest) + +**Migrated repository to [github.com/goark/koyomi][koyomi]** 「[国立天文台 天文情報センター 暦計算室](http://eco.mtk.nao.ac.jp/koyomi/)」より日本の暦情報を取得する [Go 言語]用パッケージです。 Google Calendar を経由して取得しています。 @@ -62,4 +64,4 @@ io.Copy(os.Stdout, bytes.NewReader(csv)) - [日本の暦情報を取得するパッケージを作ってみた — リリース情報 | text.Baldanders.info](https://text.baldanders.info/release/2020/05/koyomi/) [Go 言語]: https://golang.org/ "The Go Programming Language" -[koyomi]: https://github.com/spiegel-im-spiegel/koyomi "spiegel-im-spiegel/koyomi: 日本のこよみ" +[koyomi]: https://github.com/goark/koyomi "goark/koyomi: 日本のこよみ" diff --git a/Taskfile.yml b/Taskfile.yml index 116721e..84b8e69 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -13,7 +13,7 @@ tasks: cmds: - go mod verify - go test -shuffle on ./... - - docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.42.0 golangci-lint run --enable gosec --timeout 3m0s ./... + - docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.45.0 golangci-lint run --enable gosec --timeout 3m0s ./... sources: - ./go.mod - '**/*.go' @@ -21,7 +21,7 @@ tasks: nancy: desc: Check vulnerability of external packages with Nancy. cmds: - - depm list -j | docker run --rm -i sonatypecommunity/nancy:latest sleuth -n + - depm list -j | nancy sleuth -n sources: - ./go.mod - '**/*.go' @@ -32,7 +32,7 @@ tasks: - rm -f ./go.sum - go clean -cache - go clean -modcache - - go mod tidy -v -go=1.17 + - go mod tidy -v -go=1.18 graph: desc: Make grapth of dependency modules. diff --git a/date.go b/date.go index a3781aa..d800205 100644 --- a/date.go +++ b/date.go @@ -5,7 +5,7 @@ import ( "strings" "time" - "github.com/spiegel-im-spiegel/errs" + "github.com/goark/errs" ) var ( diff --git a/dependency.png b/dependency.png index ba621d3..bbfc863 100644 Binary files a/dependency.png and b/dependency.png differ diff --git a/ecode/ecode.go b/ecode/ecode.go index d3139d8..2d2e14e 100644 --- a/ecode/ecode.go +++ b/ecode/ecode.go @@ -1,30 +1,14 @@ package ecode -import "fmt" +import "errors" -//ECode is error codes for books-data -type ECode int - -const ( - ErrNullPointer ECode = iota + 1 - ErrNoData - ErrInvalidRecord +var ( + ErrNullPointer = errors.New("Null reference instance") + ErrNoData = errors.New("No data") + ErrInvalidRecord = errors.New("Invalid record") ) -var errMessages = map[ECode]string{ - ErrNullPointer: "Null reference instance", - ErrNoData: "No data", - ErrInvalidRecord: "Invalid record", -} - -func (e ECode) Error() string { - if s, ok := errMessages[e]; ok { - return s - } - return fmt.Sprintf("unknown error (%d)", int(e)) -} - -/* Copyright 2020 Spiegel +/* Copyright 2020-2022 Spiegel * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/ecode/ecode_test.go b/ecode/ecode_test.go deleted file mode 100644 index fc9b1a1..0000000 --- a/ecode/ecode_test.go +++ /dev/null @@ -1,42 +0,0 @@ -package ecode - -import ( - "fmt" - "testing" -) - -func TestECodeError(t *testing.T) { - testCases := []struct { - err error - str string - }{ - {err: ECode(0), str: "unknown error (0)"}, - {err: ErrNullPointer, str: "Null reference instance"}, - {err: ErrNoData, str: "No data"}, - {err: ErrInvalidRecord, str: "Invalid record"}, - {err: ECode(4), str: "unknown error (4)"}, - } - - for _, tc := range testCases { - errStr := tc.err.Error() - if errStr != tc.str { - t.Errorf("\"%v\" != \"%v\"", errStr, tc.str) - } - fmt.Printf("Info(TestECodeError): %+v\n", tc.err) - } -} - -/* Copyright 2020 Spiegel -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. - */ diff --git a/events.go b/events.go index c6bbb98..9d337d6 100644 --- a/events.go +++ b/events.go @@ -7,8 +7,8 @@ import ( "sort" "strconv" - "github.com/spiegel-im-spiegel/errs" - "github.com/spiegel-im-spiegel/koyomi/ecode" + "github.com/goark/errs" + "github.com/goark/koyomi/ecode" ) //Event is koyomi event data diff --git a/example_test.go b/example_test.go index e7113c8..d13d49e 100644 --- a/example_test.go +++ b/example_test.go @@ -7,7 +7,7 @@ import ( "os" "time" - "github.com/spiegel-im-spiegel/koyomi" + "github.com/goark/koyomi" ) func ExampleKoyomi() { diff --git a/go.mod b/go.mod index 6b8add6..e46ffc2 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,13 @@ -module github.com/spiegel-im-spiegel/koyomi +module github.com/goark/koyomi -go 1.17 +go 1.18 require ( github.com/PuloV/ics-golang v0.0.0-20190808201353-a3394d3bcade - github.com/spiegel-im-spiegel/errs v1.0.5 + github.com/goark/errs v1.1.0 ) require ( github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 // indirect - github.com/stretchr/testify v1.7.0 // indirect + github.com/stretchr/testify v1.7.1 // indirect ) diff --git a/go.sum b/go.sum index 8d9d53a..1110653 100644 --- a/go.sum +++ b/go.sum @@ -4,13 +4,13 @@ github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 h1:o6 github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61/go.mod h1:Rp8e0DCtEKwXFOC6JPJQVTz8tuGoGvw6Xfexggh/ed0= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/goark/errs v1.1.0 h1:FKnyw4LVyRADIjM8Nj0Up6r0/y5cfADvZAd1E+tthXE= +github.com/goark/errs v1.1.0/go.mod h1:TtaPEoadm2mzqzfXdkkfpN2xuniCFm2q4JH+c1qzaqw= 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/spiegel-im-spiegel/errs v1.0.5 h1:5qAUEXPZgF4ZIUmw2vpe7OgDP0C8DIV67BKwjfLidJI= -github.com/spiegel-im-spiegel/errs v1.0.5/go.mod h1:mOsWcUc9hpRXjwdgJqJ3E2n6ibkYFvhNck1QD0ZVGOM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 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= diff --git a/source.go b/source.go index fc4abee..8353c93 100644 --- a/source.go +++ b/source.go @@ -2,8 +2,8 @@ package koyomi import ( ics "github.com/PuloV/ics-golang" - "github.com/spiegel-im-spiegel/errs" - "github.com/spiegel-im-spiegel/koyomi/ecode" + "github.com/goark/errs" + "github.com/goark/koyomi/ecode" ) //Source is information of data source for koyomi