Skip to content

Commit df8a0ab

Browse files
authored
Merge pull request #23 from ldez/fix/ci
chore: use GitHub Action
2 parents 82fe695 + 87e3db6 commit df8a0ab

File tree

4 files changed

+76
-58
lines changed

4 files changed

+76
-58
lines changed

.circleci/config.yml

-26
This file was deleted.

.github/workflows/go-cross.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Go Matrix
2+
on: [push, pull_request]
3+
4+
jobs:
5+
6+
cross:
7+
name: Go
8+
runs-on: ${{ matrix.os }}
9+
env:
10+
CGO_ENABLED: 0
11+
12+
strategy:
13+
matrix:
14+
go-version: [ oldstable, stable ]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
17+
steps:
18+
# https://github.com/marketplace/actions/checkout
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
# https://github.com/marketplace/actions/setup-go-environment
23+
- name: Set up Go ${{ matrix.go-version }}
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ matrix.go-version }}
27+
28+
- name: Test
29+
run: go test -v -cover ./...
30+
31+
- name: Build
32+
run: go build -v -ldflags "-s -w" -trimpath

.github/workflows/main.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Main
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
11+
main:
12+
name: Main Process
13+
runs-on: ubuntu-latest
14+
env:
15+
GO_VERSION: stable
16+
GOLANGCI_LINT_VERSION: v1.57.0
17+
CGO_ENABLED: 0
18+
19+
steps:
20+
# https://github.com/marketplace/actions/checkout
21+
- name: Check out code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
# https://github.com/marketplace/actions/setup-go-environment
27+
- name: Set up Go ${{ env.GO_VERSION }}
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version: ${{ env.GO_VERSION }}
31+
32+
- name: Check and get dependencies
33+
run: |
34+
go mod download
35+
go mod tidy
36+
git diff --exit-code go.mod
37+
git diff --exit-code go.sum
38+
39+
# https://golangci-lint.run/usage/install#other-ci
40+
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
41+
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}
42+
43+
- name: Make
44+
run: make

contextcheck.go

-32
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"go/token"
66
"go/types"
77
"regexp"
8-
"strconv"
98
"strings"
109
"sync"
1110

@@ -222,37 +221,6 @@ func (r *runner) collectHttpTyps(pssa *buildssa.SSA) {
222221
}
223222
}
224223

225-
func (r *runner) noImportedContextAndHttp(f *ssa.Function) (ret bool) {
226-
if !f.Pos().IsValid() {
227-
return false
228-
}
229-
230-
file := analysisutil.File(r.pass, f.Pos())
231-
if file == nil {
232-
return false
233-
}
234-
235-
if skip, has := r.skipFile[file]; has {
236-
return skip
237-
}
238-
defer func() {
239-
r.skipFile[file] = ret
240-
}()
241-
242-
for _, impt := range file.Imports {
243-
path, err := strconv.Unquote(impt.Path.Value)
244-
if err != nil {
245-
continue
246-
}
247-
path = analysisutil.RemoveVendor(path)
248-
if path == ctxPkg || path == httpPkg {
249-
return false
250-
}
251-
}
252-
253-
return true
254-
}
255-
256224
func (r *runner) checkIsEntry(f *ssa.Function) (ret entryType) {
257225
// if r.noImportedContextAndHttp(f) {
258226
// return EntryNormal

0 commit comments

Comments
 (0)