Skip to content

Commit d8efe1c

Browse files
committed
Merge branch 'release/v0.5.0'
2 parents 372a82d + cfcaf3e commit d8efe1c

File tree

20 files changed

+667
-77
lines changed

20 files changed

+667
-77
lines changed

.github/workflows/build.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
12+
go-legacy-test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
go-version: [ '1.20', '1.21' ]
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: ${{ matrix.go-version }}
23+
- name: Go get
24+
run: go get -t ./...
25+
- name: Build
26+
run: go build -v ./...
27+
- name: Test
28+
run: go test -v ./...
29+
30+
test:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: '1.22.4'
38+
- name: Go get
39+
run: go get -t ./...
40+
- name: Build
41+
run: go build -v ./...
42+
- name: Test
43+
run: go test -v -covermode=atomic -coverprofile=cover.out -coverpkg=. ./...
44+
- name: Install goveralls
45+
run: go install github.com/mattn/goveralls@latest
46+
- name: Send coverage
47+
env:
48+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: goveralls -coverprofile=cover.out -service=github
50+
51+
lint:
52+
runs-on: ubuntu-latest
53+
steps:
54+
- uses: actions/checkout@v4
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version: '1.22.4'
59+
- name: Install checks
60+
run: |
61+
go install honnef.co/go/tools/cmd/staticcheck@latest
62+
go install github.com/client9/misspell/cmd/misspell@latest
63+
- name: Go get
64+
run: go get -t ./...
65+
- name: Go vet
66+
run: go vet $(go list ./... | grep -v /vendor/)
67+
- name: Go mod
68+
run: go mod tidy; git diff --exit-code go.mod go.sum
69+
- name: Go fmt
70+
run: go fmt $(go list ./... | grep -v /vendor/); git diff --exit-code
71+
- name: Staticcheck
72+
run: staticcheck -checks all,-ST1000 ./...
73+
- name: Misspell
74+
run: misspell -error -locale US .

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
# Make sure the GITHUB_TOKEN has permission to upload to our releases
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
14+
create_release:
15+
name: Create Release
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Check out the repo
19+
uses: actions/checkout@v4
20+
- name: Create release draft
21+
id: create_release
22+
uses: actions/create-release@v1
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
tag_name: ${{ github.ref }}
27+
release_name: Release ${{ github.ref_name }}
28+
body: |
29+
A new release
30+
draft: true
31+
prerelease: false

.travis.yml

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<p align="center"><a href="https://resgate.io" target="_blank" rel="noopener noreferrer"><img width="100" src="https://resgate.io/img/resgate-logo.png" alt="Resgate logo"></a></p>
22
<h2 align="center"><b>RES Service for Go</b><br/>Synchronize Your Clients</h2>
33
<p align="center">
4-
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
4+
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
55
<a href="http://goreportcard.com/report/jirenius/go-res"><img src="http://goreportcard.com/badge/github.com/jirenius/go-res" alt="Report Card"></a>
6-
<a href="https://travis-ci.com/jirenius/go-res"><img src="https://travis-ci.com/jirenius/go-res.svg?branch=master" alt="Build Status"></a>
6+
<a href="https://github.com/jirenius/go-res/actions/workflows/build.yml?query=branch%3Amaster"><img src="https://img.shields.io/github/actions/workflow/status/jirenius/go-res/build.yml?branch=master" alt="Build Status"></a>
77
<a href="https://coveralls.io/github/jirenius/go-res?branch=master"><img src="https://coveralls.io/repos/github/jirenius/go-res/badge.svg?branch=master" alt="Coverage"></a>
88
<a href="https://pkg.go.dev/github.com/jirenius/go-res"><img src="https://img.shields.io/static/v1?label=reference&message=go.dev&color=5673ae" alt="Reference"></a>
99
</p>

codec.go

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,33 @@ type resRequest struct {
1111
RemoteAddr string `json:"remoteAddr"`
1212
URI string `json:"uri"`
1313
Query string `json:"query"`
14+
IsHTTP bool `json:"isHttp"`
15+
}
16+
17+
type metaObject struct {
18+
Status int `json:"status,omitempty"`
19+
Header map[string][]string `json:"header,omitempty"`
1420
}
1521

1622
type successResponse struct {
1723
Result interface{} `json:"result"`
24+
Meta *metaObject `json:"meta,omitempty"`
1825
}
1926

2027
type resourceResponse struct {
21-
Resource Ref `json:"resource"`
28+
Resource Ref `json:"resource"`
29+
Meta *metaObject `json:"meta,omitempty"`
2230
}
2331

2432
type errorResponse struct {
25-
Error *Error `json:"error"`
33+
Error *Error `json:"error"`
34+
Meta *metaObject `json:"meta,omitempty"`
2635
}
2736

2837
type accessResponse struct {
29-
Get bool `json:"get,omitempty"`
30-
Call string `json:"call,omitempty"`
38+
Get bool `json:"get,omitempty"`
39+
Call string `json:"call,omitempty"`
40+
Meta *metaObject `json:"meta,omitempty"`
3141
}
3242

3343
type modelResponse struct {

go.mod

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/jirenius/go-res
22

3-
go 1.12
3+
go 1.18
44

55
require (
66
github.com/dgraph-io/badger v1.6.2
@@ -10,5 +10,21 @@ require (
1010
github.com/nats-io/nats-server/v2 v2.1.8
1111
github.com/nats-io/nats.go v1.10.0
1212
github.com/rs/xid v1.2.1
13+
)
14+
15+
require (
16+
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
17+
github.com/cespare/xxhash v1.1.0 // indirect
18+
github.com/dgraph-io/ristretto v0.0.2 // indirect
19+
github.com/dustin/go-humanize v1.0.0 // indirect
20+
github.com/golang/protobuf v1.4.0 // indirect
21+
github.com/nats-io/jwt v0.3.2 // indirect
22+
github.com/nats-io/nkeys v0.1.4 // indirect
23+
github.com/nats-io/nuid v1.0.1 // indirect
24+
github.com/pkg/errors v0.8.1 // indirect
1325
github.com/stretchr/testify v1.6.1 // indirect
26+
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59 // indirect
27+
golang.org/x/net v0.0.0-20190620200207-3b0461eec859 // indirect
28+
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e // indirect
29+
google.golang.org/protobuf v1.22.0 // indirect
1430
)

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ github.com/jirenius/taskqueue v1.1.0 h1:V7Z/XeR515i96YmohoD1rXawAcGBONrd8+LGfckZ
4141
github.com/jirenius/taskqueue v1.1.0/go.mod h1:/x5dz4AGqzGI6FmIC+0rmbx6JBUGgJiQzb71JFy/JRg=
4242
github.com/jirenius/timerqueue v1.0.0 h1:TgcUQlrxKBBHYmStXPzLdMPJFfmqkWZZ1s7BA5G1d9E=
4343
github.com/jirenius/timerqueue v1.0.0/go.mod h1:pUEjy16BUruJMjLIsjWvWQh9Bu9CSXCIfGADZf37WIk=
44-
github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs=
4544
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
4645
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
47-
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
4846
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
4947
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
5048
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
@@ -109,7 +107,6 @@ google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzi
109107
google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY=
110108
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
111109
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
112-
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
113110
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
114111
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
115112
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=

mux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ func (m *Mux) ValidateListeners() (err error) {
266266
errs = append(errs, "no handler registered for pattern: "+mergePattern(m.FullPath(), pathSliceToString(n, path, mountIdx)))
267267
}
268268
})
269-
if err != nil {
269+
if errs != nil {
270270
return errors.New(strings.Join(errs, "\n"))
271271
}
272272
return nil

0 commit comments

Comments
 (0)