From 6686e0205771258f96601b880ad5419257d247f2 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Sat, 17 Jul 2021 16:57:52 +0900 Subject: [PATCH 01/16] use `go install` instead of `go get` in README using `go get` for installing commands will be deprecated. we should use `go install` instead of it. > https://tip.golang.org/doc/go1.17#go-get > go get prints a deprecation warning when installing commands outside the main module (without the -d flag). > go install cmd@version should be used instead to install a command at a specific version, using a suffix like @latest or @v1.2.3. > In Go 1.18, the -d flag will always be enabled, and go get will only be used to change dependencies in go.mod. --- README.md | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 510901a..07988c6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ continuous code coverage tracking system. `goveralls` requires a working Go installation (Go-1.2 or higher). ```bash -$ go get github.com/mattn/goveralls +$ go install github.com/mattn/goveralls@latest ``` @@ -64,9 +64,7 @@ jobs: run: | go test -race -covermode atomic -coverprofile=covprofile ./... - name: Install goveralls - env: - GO111MODULE: off - run: go get github.com/mattn/goveralls + run: go install github.com/mattn/goveralls@latest - name: Send coverage env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -113,9 +111,7 @@ jobs: go test -race -covermode atomic -coverprofile=covprofile ./... working-directory: src/example.com/owner/repo # add this - name: Install goveralls - env: - GO111MODULE: off - run: go get github.com/mattn/goveralls + run: go install github.com/mattn/goveralls@latest - name: Send coverage env: COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -136,7 +132,7 @@ language: go go: - tip before_install: - - go get github.com/mattn/goveralls + - go install github.com/mattn/goveralls@latest script: - $GOPATH/bin/goveralls -service=travis-ci ``` @@ -150,7 +146,7 @@ language: go go: - tip before_install: - - go get github.com/mattn/goveralls + - go install github.com/mattn/goveralls@latest script: - $GOPATH/bin/goveralls -service=travis-pro ``` @@ -179,7 +175,7 @@ env: ### For others: ``` -$ go get github.com/mattn/goveralls +$ go install github.com/mattn/goveralls@latest $ go test -covermode=count -coverprofile=profile.cov $ goveralls -coverprofile=profile.cov -service=travis-ci ``` @@ -195,7 +191,7 @@ COVERALLS_TOKEN=your_token_goes_here Replace the `go test` line in your `Commands` with these lines: ``` -$ go get github.com/mattn/goveralls +$ go install github.com/mattn/goveralls@latest $ goveralls -service drone.io ``` @@ -217,7 +213,7 @@ In your `circle.yml` add the following commands under the `test` section. ```yml test: pre: - - go get github.com/mattn/goveralls + - go install github.com/mattn/goveralls@latest override: - go test -v -cover -race -coverprofile=/home/ubuntu/coverage.out post: @@ -239,7 +235,7 @@ More instructions on how to do this can be found in the [Semaphore documentation Replace the `go test` line in your `Commands` with these lines: ``` -$ go get github.com/mattn/goveralls +$ go install github.com/mattn/goveralls@latest $ goveralls -service semaphore ``` @@ -293,7 +289,7 @@ COVERALLS_TOKEN=your_token_goes_here Setup build steps: ``` -$ go get github.com/mattn/goveralls +$ go install github.com/mattn/goveralls@latest $ export PULL_REQUEST_NUMBER=%teamcity.build.branch% $ goveralls -service teamcity -jobid %teamcity.build.id% -jobnumber %build.number% ``` @@ -320,7 +316,7 @@ test: when: always script: - go test -covermode atomic -coverprofile=coverage.txt ./... - - go get github.com/mattn/goveralls + - go install github.com/mattn/goveralls@latest - goveralls -service=gitlab -coverprofile=coverage.txt ``` From fb789482cd1eb854e36f21c6d3cc572096041c7c Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Tue, 21 Sep 2021 07:28:39 +0900 Subject: [PATCH 02/16] shallow 405 method not allowed --- goveralls.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/goveralls.go b/goveralls.go index 126feb7..74e31ef 100644 --- a/goveralls.go +++ b/goveralls.go @@ -268,12 +268,23 @@ func processParallelFinish(jobID, token string) error { return fmt.Errorf("unable to read response body from coveralls: %s", err) } - if res.StatusCode >= http.StatusInternalServerError && *shallow { - fmt.Println("coveralls server failed internally") - return nil + if *shallow { + if res.StatusCode >= http.StatusInternalServerError { + fmt.Println("coveralls server failed internally") + return nil + } + + // XXX: It looks that Coveralls is under maintenance. + // Coveralls serves the maintenance page as a static HTML hosting, + // and the maintenance page doesn't accept POST method. + // See https://github.com/mattn/goveralls/issues/204 + if res.StatusCode == http.StatusMethodNotAllowed { + fmt.Println("it looks that Coveralls is under maintenance. visit https://status.coveralls.io/") + return nil + } } - if res.StatusCode != 200 { + if res.StatusCode != http.StatusOK { return fmt.Errorf("bad response status from coveralls: %d\n%s", res.StatusCode, bodyBytes) } From bf9a88aa4fde8c0a94499eebe0c43f3e6794d0e5 Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Tue, 21 Sep 2021 10:54:02 +0900 Subject: [PATCH 03/16] go1.17.1 fmt --- gocover_ge1.8.go | 1 + gocover_lt1.8.go | 1 + usage_ge1.15_test.go | 1 + usage_lt1.15_test.go | 1 + 4 files changed, 4 insertions(+) diff --git a/gocover_ge1.8.go b/gocover_ge1.8.go index 4b880a5..af71a75 100644 --- a/gocover_ge1.8.go +++ b/gocover_ge1.8.go @@ -1,3 +1,4 @@ +//go:build go1.8 // +build go1.8 package main diff --git a/gocover_lt1.8.go b/gocover_lt1.8.go index 263306e..5c3b69d 100644 --- a/gocover_lt1.8.go +++ b/gocover_lt1.8.go @@ -1,3 +1,4 @@ +//go:build !go1.8 // +build !go1.8 package main diff --git a/usage_ge1.15_test.go b/usage_ge1.15_test.go index d6e4e08..ea5baf8 100644 --- a/usage_ge1.15_test.go +++ b/usage_ge1.15_test.go @@ -1,3 +1,4 @@ +//go:build go1.15 // +build go1.15 package main diff --git a/usage_lt1.15_test.go b/usage_lt1.15_test.go index 3a54e76..947e3cf 100644 --- a/usage_lt1.15_test.go +++ b/usage_lt1.15_test.go @@ -1,3 +1,4 @@ +//go:build !go1.15 // +build !go1.15 package main From d16f5279f26eda48e10a880e4d773d7b6be3380b Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Tue, 21 Sep 2021 10:54:17 +0900 Subject: [PATCH 04/16] go mod tidy -go=1.17 --- go.mod | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 661fe67..316e2d9 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,10 @@ module github.com/mattn/goveralls -go 1.11 +go 1.17 require ( golang.org/x/mod v0.4.2 golang.org/x/tools v0.1.1 ) + +require golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect From c814499413fcff1293c3217bda95bd77d9c84aec Mon Sep 17 00:00:00 2001 From: Ichinose Shogo Date: Tue, 21 Sep 2021 17:23:23 +0900 Subject: [PATCH 05/16] shallow 405 Method Not Allowed in process() --- goveralls.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/goveralls.go b/goveralls.go index 74e31ef..b736ed8 100644 --- a/goveralls.go +++ b/goveralls.go @@ -513,9 +513,20 @@ func process() error { return fmt.Errorf("unable to read response body from coveralls: %s", err) } - if res.StatusCode >= http.StatusInternalServerError && *shallow { - fmt.Println("coveralls server failed internally") - return nil + if *shallow { + if res.StatusCode >= http.StatusInternalServerError { + fmt.Println("coveralls server failed internally") + return nil + } + + // XXX: It looks that Coveralls is under maintenance. + // Coveralls serves the maintenance page as a static HTML hosting, + // and the maintenance page doesn't accept POST method. + // See https://github.com/mattn/goveralls/issues/204 + if res.StatusCode == http.StatusMethodNotAllowed { + fmt.Println("it looks that Coveralls is under maintenance. visit https://status.coveralls.io/") + return nil + } } if res.StatusCode != 200 { From b12a325bfdd13b99e74695f5ff1b8528bf9e411b Mon Sep 17 00:00:00 2001 From: tabbycat01 Date: Sat, 8 Jan 2022 15:22:45 +0800 Subject: [PATCH 06/16] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 07988c6..6d9bf83 100644 --- a/README.md +++ b/README.md @@ -52,9 +52,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v1 + uses: actions/setup-go@v2 with: - go-version: '1.13' + go-version: '1.16' - name: Check out code uses: actions/checkout@v2 - name: Install dependencies From 77d92ed0861d369d723f77613e5bc97584829e9a Mon Sep 17 00:00:00 2001 From: hftsin Date: Wed, 15 Jun 2022 16:02:47 +0800 Subject: [PATCH 07/16] Fix 500 when running with `-parallel-finish` in circleci --- goveralls.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/goveralls.go b/goveralls.go index b736ed8..0194ca6 100644 --- a/goveralls.go +++ b/goveralls.go @@ -248,7 +248,9 @@ func processParallelFinish(jobID, token string) error { params := make(url.Values) params.Set("repo_token", token) - params.Set("repo_name", name) + if name != "" { + params.Set("repo_name", name) + } params.Set("payload[build_num]", jobID) params.Set("payload[status]", "done") res, err := http.PostForm(*endpoint+"/webhook", params) From ed835f3df8deaee9b6d7a781043890ad4feaf834 Mon Sep 17 00:00:00 2001 From: malteehrlen <42444300+malteehrlen@users.noreply.github.com> Date: Tue, 28 Jun 2022 15:54:52 +0200 Subject: [PATCH 08/16] Create LICENSE.md with contents from readme url --- LICENSE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..0e51d28 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright © 2016-2022 Yasuhiro Matsumoto, http://mattn.kaoriya.net + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From c34ee2774d9bb57f2b4665a0849e56862be57fa8 Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 28 Jun 2022 23:26:55 +0900 Subject: [PATCH 09/16] Update and rename LICENSE.md to LICENSE --- LICENSE | 21 +++++++++++++++++++++ LICENSE.md | 9 --------- 2 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 LICENSE delete mode 100644 LICENSE.md diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a6523a0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Yasuhiro Matsumoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index 0e51d28..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,9 +0,0 @@ -The MIT License (MIT) - -Copyright © 2016-2022 Yasuhiro Matsumoto, http://mattn.kaoriya.net - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 5034c097a9ff79e1b3e3f8f0a1712feeadee1aaf Mon Sep 17 00:00:00 2001 From: Yuto Suzuki Date: Fri, 21 Oct 2022 12:10:24 +0900 Subject: [PATCH 10/16] go mod tidy -compat=1.17 --- go.sum | 9 --------- 1 file changed, 9 deletions(-) diff --git a/go.sum b/go.sum index 9ba29a2..12fe1c1 100644 --- a/go.sum +++ b/go.sum @@ -1,23 +1,14 @@ -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= From 4844dffe03a296947751c7dcfb4eb07328a9639a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Fri, 7 Apr 2023 12:59:44 +0200 Subject: [PATCH 11/16] feat: Add `CIRCLE_PULL_REQUEST` env variable --- goveralls.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/goveralls.go b/goveralls.go index b736ed8..1ec1f0d 100644 --- a/goveralls.go +++ b/goveralls.go @@ -390,6 +390,9 @@ func process() error { if prNumber := os.Getenv("CIRCLE_PR_NUMBER"); prNumber != "" { // for Circle CI (pull request from forked repo) pullRequest = prNumber + } else if prURL := os.Getenv("CIRCLE_PULL_REQUEST"); prURL != "" { + // for Circle CI (all other pull requests) + pullRequest = regexp.MustCompile(`[0-9]+$`).FindString(prURL) } else if prNumber := os.Getenv("TRAVIS_PULL_REQUEST"); prNumber != "" && prNumber != "false" { pullRequest = prNumber } else if prNumber := os.Getenv("APPVEYOR_PULL_REQUEST_NUMBER"); prNumber != "" { From 8859e57a02fcdb359a8b0bbdfb27aaa08bfa77af Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Wed, 26 Apr 2023 21:07:16 +0900 Subject: [PATCH 12/16] drop support of Go 1.12 --- .github/workflows/main.yml | 27 +++++++-------------------- go.mod | 4 +--- go.sum | 9 +++++++++ gocover.go | 10 ++++++++++ gocover_ge1.8.go | 20 -------------------- gocover_lt1.8.go | 8 -------- 6 files changed, 27 insertions(+), 51 deletions(-) delete mode 100644 gocover_ge1.8.go delete mode 100644 gocover_lt1.8.go diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 60a332c..34316c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,36 +12,25 @@ jobs: - macos-latest - windows-latest go: - - '1.7' # minimum version that macos-latest supports - - '1.10' # last version that doesn't support go modules - - '1.11' # first version that supports go modules - - '1.x' # latest version + - '1.13' # minimum version + - 'oldstable' + - 'stable' runs-on: ${{ matrix.os }} steps: - name: Set up Go ${{ matrix.go }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: go version - - name: Set up GOPATH - shell: bash - run: | - echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV" - echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - uses: actions/checkout@v2 - with: - path: src/github.com/mattn/goveralls - ref: ${{ github.event.pull_request.head.sha }} + - uses: actions/checkout@v3 - name: build run: | go get ./... go install . - working-directory: src/github.com/mattn/goveralls - name: test run: goveralls -service=github -parallel -flagname="Unit-${{ matrix.os }}-Go-${{ matrix.go }}" - working-directory: src/github.com/mattn/goveralls env: COVERALLS_TOKEN: ${{ github.token }} GIT_BRANCH: ${{ github.head_ref }} @@ -51,10 +40,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: '1.x' - - uses: actions/checkout@v2 + uses: actions/setup-go@v4 + - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - name: finish diff --git a/go.mod b/go.mod index 316e2d9..a0310a1 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,8 @@ module github.com/mattn/goveralls -go 1.17 +go 1.12 require ( golang.org/x/mod v0.4.2 golang.org/x/tools v0.1.1 ) - -require golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect diff --git a/go.sum b/go.sum index 12fe1c1..9ba29a2 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,23 @@ +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= diff --git a/gocover.go b/gocover.go index ecd1b5d..1c6fdfa 100644 --- a/gocover.go +++ b/gocover.go @@ -16,6 +16,7 @@ import ( "path/filepath" "strings" + "golang.org/x/mod/modfile" "golang.org/x/tools/cover" ) @@ -176,3 +177,12 @@ func parseCover(fn string) ([]*SourceFile, error) { return sourceFiles, nil } + +func findRootPackage(rootDirectory string) string { + modPath := filepath.Join(rootDirectory, "go.mod") + content, err := ioutil.ReadFile(modPath) + if err != nil { + return "" + } + return modfile.ModulePath(content) +} diff --git a/gocover_ge1.8.go b/gocover_ge1.8.go deleted file mode 100644 index af71a75..0000000 --- a/gocover_ge1.8.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build go1.8 -// +build go1.8 - -package main - -import ( - "io/ioutil" - "path/filepath" - - "golang.org/x/mod/modfile" -) - -func findRootPackage(rootDirectory string) string { - modPath := filepath.Join(rootDirectory, "go.mod") - content, err := ioutil.ReadFile(modPath) - if err != nil { - return "" - } - return modfile.ModulePath(content) -} diff --git a/gocover_lt1.8.go b/gocover_lt1.8.go deleted file mode 100644 index 5c3b69d..0000000 --- a/gocover_lt1.8.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:build !go1.8 -// +build !go1.8 - -package main - -func findRootPackage(rootDirectory string) string { - return "" -} From 7a53bd342d6b8b00eb7b8efcf0eaa593fe58ca83 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Wed, 26 Apr 2023 21:14:13 +0900 Subject: [PATCH 13/16] bump x/mod v0.10.0 --- go.mod | 6 +++--- go.sum | 45 +++++++++++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index a0310a1..22d9256 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/mattn/goveralls -go 1.12 +go 1.13 require ( - golang.org/x/mod v0.4.2 - golang.org/x/tools v0.1.1 + golang.org/x/mod v0.10.0 + golang.org/x/tools v0.8.0 ) diff --git a/go.sum b/go.sum index 9ba29a2..d3a6c58 100644 --- a/go.sum +++ b/go.sum @@ -1,27 +1,40 @@ -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= +golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/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/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.1 h1:wGiQel/hW0NnEkJUk8lbzkX2gFJU6PFxf1v5OlCfuOs= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.8.0 h1:vSDcovVPld282ceKgDimkRSC8kpaH1dgyc9UMzlt84Y= +golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4= 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-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= From 3ef4d88ef64afcee9089e2723da432e1dc6aaae5 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Wed, 26 Apr 2023 21:17:16 +0900 Subject: [PATCH 14/16] checkout the head of pull request --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 34316c2..bb50d06 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,13 +18,16 @@ jobs: runs-on: ${{ matrix.os }} steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Set up Go ${{ matrix.go }} uses: actions/setup-go@v4 with: go-version: ${{ matrix.go }} - run: go version - - uses: actions/checkout@v3 - name: build run: | go get ./... @@ -39,11 +42,11 @@ jobs: needs: test runs-on: ubuntu-latest steps: - - name: Set up Go - uses: actions/setup-go@v4 - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Set up Go + uses: actions/setup-go@v4 - name: finish run: | go run github.com/mattn/goveralls -parallel-finish From eeb00ed3471c3586c79c01856a88f56ab2980697 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Wed, 26 Apr 2023 21:20:46 +0900 Subject: [PATCH 15/16] remove the section: Test with Legacy GOPATH mode --- README.md | 53 +++++------------------------------------------------ 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 6d9bf83..b407c6e 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ docs](https://docs.coveralls.io/parallel-build-webhook) for more details). There is no need to run `go test` separately, as `goveralls` runs the entire test suite. -## Github Actions +## GitHub Actions [shogo82148/actions-goveralls](https://github.com/marketplace/actions/actions-goveralls) is available on GitHub Marketplace. It provides the shorthand of the GitHub Actions YAML configure. @@ -76,56 +76,13 @@ jobs: # path-to-profile: covprofile ``` -### Test with Legacy GOPATH mode - -If you want to use Go 1.10 or earlier, you have to set `GOPATH` environment value and the working directory. -See for more detail. - -Here is an example for testing `example.com/owner/repo` package. - -```yaml -name: Quality -on: [push, pull_request] -jobs: - test: - name: Test with Coverage - runs-on: ubuntu-latest - steps: - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: '1.10' - - # add this step - - name: Set up GOPATH - run: | - echo "GOPATH=${{ github.workspace }}" >> "$GITHUB_ENV" - echo "${{ github.workspace }}/bin" >> "$GITHUB_PATH" - - - name: Check out code - uses: actions/checkout@v2 - with: - path: src/example.com/owner/repo # add this - - name: Run Unit tests - run: | - go test -race -covermode atomic -coverprofile=covprofile ./... - working-directory: src/example.com/owner/repo # add this - - name: Install goveralls - run: go install github.com/mattn/goveralls@latest - - name: Send coverage - env: - COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: goveralls -coverprofile=covprofile -service=github - working-directory: src/example.com/owner/repo # add this -``` - ## Travis CI ### GitHub Integration -Enable Travis-CI on your github repository settings. +Enable Travis-CI on your GitHub repository settings. -For a **public** github repository put bellow's `.travis.yml`. +For a **public** GitHub repository put bellow's `.travis.yml`. ```yml language: go @@ -137,9 +94,9 @@ script: - $GOPATH/bin/goveralls -service=travis-ci ``` -For a **public** github repository, it is not necessary to define your repository key (`COVERALLS_TOKEN`). +For a **public** GitHub repository, it is not necessary to define your repository key (`COVERALLS_TOKEN`). -For a **private** github repository put bellow's `.travis.yml`. If you use **travis pro**, you need to specify `-service=travis-pro` instead of `-service=travis-ci`. +For a **private** GitHub repository put bellow's `.travis.yml`. If you use **travis pro**, you need to specify `-service=travis-pro` instead of `-service=travis-ci`. ```yml language: go From 9e8fe1bf7509afde0edd3974fb384b266978b5a8 Mon Sep 17 00:00:00 2001 From: ICHINOSE Shogo Date: Wed, 26 Apr 2023 21:25:46 +0900 Subject: [PATCH 16/16] fix minimum version of Go in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b407c6e..20c480b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ continuous code coverage tracking system. # Installation -`goveralls` requires a working Go installation (Go-1.2 or higher). +`goveralls` requires a working Go installation (Go-1.13 or higher). ```bash $ go install github.com/mattn/goveralls@latest