Skip to content

Commit 6115d9f

Browse files
migrate github workflow
1 parent 800c5f4 commit 6115d9f

File tree

15 files changed

+104
-99
lines changed

15 files changed

+104
-99
lines changed

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Go CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- "**"
10+
permissions:
11+
actions: write
12+
contents: read
13+
id-token: write
14+
15+
jobs:
16+
test:
17+
strategy:
18+
matrix:
19+
go-version: ["1.20", "1.23", "1.24"]
20+
os: [ubuntu-latest]
21+
fail-fast: false
22+
23+
runs-on: ${{ matrix.os }}
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v3
27+
28+
- name: Setup Go ${{ matrix.go }}
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: ${{ matrix.go-version }}
32+
cache: true
33+
34+
- name: Verify Go version
35+
run: go version
36+
37+
- name: Install dependencies
38+
run: go mod tidy
39+
40+
- name: Run Tests
41+
run: go test -race -coverprofile="coverage.out" -v ./...
42+
43+
- uses: qltysh/qlty-action/coverage@v1
44+
with:
45+
oidc: true
46+
files: coverage.out

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
# Output of the go coverage tool, specifically when used with LiteIDE
1212
*.out
1313

14+
coverage
1415
vendor

.travis.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

auth/http_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ func TestFromHeader(t *testing.T) {
2121
{
2222
request: &http.Request{Header: http.Header{
2323
"Authorization": []string{"foo"},
24-
},},
24+
}},
2525
expectedCredential: "foo",
2626
},
2727
{
2828
request: &http.Request{Header: http.Header{
2929
"X-Authorization": []string{"foo"},
30-
},},
30+
}},
3131
expectedCredential: "foo",
3232
},
3333
{
3434
request: &http.Request{Header: http.Header{
35-
"Authorization": []string{"foo"},
35+
"Authorization": []string{"foo"},
3636
"X-Authorization": []string{"bar"},
37-
},},
37+
}},
3838
expectedCredential: "foo",
3939
},
4040
}

correlation_id/generator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"unsafe"
77
)
88

9-
//https://stackoverflow.com/a/31832326
9+
// https://stackoverflow.com/a/31832326
1010
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
1111
const (
1212
letterIdxBits = 6 // 6 bits to represent a letter index

go.mod

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
module github.com/gol4ng/httpware/v4
22

3-
go 1.10
3+
go 1.20
44

55
require (
6-
github.com/felixge/httpsnoop v1.0.3
6+
github.com/felixge/httpsnoop v1.0.4
77
github.com/prometheus/client_golang v1.14.0
8-
github.com/stretchr/testify v1.8.2
8+
github.com/stretchr/testify v1.10.0
99
)
1010

1111
require (
12-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
13-
github.com/prometheus/common v0.41.0 // indirect
14-
github.com/prometheus/procfs v0.9.0 // indirect
15-
golang.org/x/sys v0.6.0 // indirect
12+
github.com/beorn7/perks v1.0.1 // indirect
13+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
14+
github.com/davecgh/go-spew v1.1.1 // indirect
15+
github.com/golang/protobuf v1.5.2 // indirect
16+
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
17+
github.com/pmezard/go-difflib v1.0.0 // indirect
18+
github.com/prometheus/client_model v0.3.0 // indirect
19+
github.com/prometheus/common v0.37.0 // indirect
20+
github.com/prometheus/procfs v0.8.0 // indirect
21+
github.com/stretchr/objx v0.5.2 // indirect
22+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
23+
google.golang.org/protobuf v1.28.1 // indirect
24+
gopkg.in/yaml.v3 v3.0.1 // indirect
1625
)

go.sum

Lines changed: 14 additions & 51 deletions
Large diffs are not rendered by default.

interceptor/copy_read_closer.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ type copyReadCloser struct {
3737
}
3838

3939
// First read with io.TeeReader
40-
// -> copyBuffered
41-
// /
40+
//
41+
// -> copyBuffered
42+
// /
43+
//
4244
// src --> output
4345
// Second read after EOF
4446
// copyBuffered --> copy BufReader simple buffer with fix size

middleware/correlation_id_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func ExampleCorrelationId() {
7272
}
7373
}()
7474

75-
resp, err := http.Get("http://"+ln.Addr().String())
75+
resp, err := http.Get("http://" + ln.Addr().String())
7676
if err != nil {
7777
fmt.Println(err)
7878
} else if resp != nil {

middleware/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/gol4ng/httpware/v4/metrics"
1111
)
1212

13-
func Metrics(recorder metrics.Recorder, options ... metrics.Option) httpware.Middleware {
13+
func Metrics(recorder metrics.Recorder, options ...metrics.Option) httpware.Middleware {
1414
config := metrics.NewConfig(recorder, options...)
1515
return func(next http.Handler) http.Handler {
1616
return http.HandlerFunc(func(writer http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)