Skip to content

Commit 1dd3eba

Browse files
authored
feat: add import endpoint (#172)
1 parent a78a42a commit 1dd3eba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+263
-134
lines changed

.github/workflows/go.yml renamed to .github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,17 @@ jobs:
1616
strategy:
1717
max-parallel: 1
1818
matrix:
19-
goVer: [1.16, 1.17]
19+
goVer: ["^1.16", "^1.17"]
2020
steps:
2121
- name: Set up Go ${{ matrix.goVer }}
22-
uses: actions/setup-go@v1
22+
uses: actions/setup-go@v2
2323
with:
2424
go-version: ${{ matrix.goVer }}
25-
id: go
2625

27-
- name: Check out code into the Go module directory
28-
uses: actions/checkout@v2
26+
- uses: actions/checkout@v2
2927

3028
- name: Test via ${{ matrix.goVer }}
3129
env:
32-
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
33-
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
30+
STREAM_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
31+
STREAM_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
3432
run: go test -v -race ./...

.github/workflows/lint.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,3 @@ jobs:
2626

2727
- name: Tidy
2828
run: go mod tidy -v && git diff --no-patch --exit-code || { git status; echo 'Unchecked diff, did you forget go mod tidy again?' ; false ; };
29-
30-
- name: Run Lint
31-
run: ./run-lint.sh

.github/workflows/reviewdog.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: reviewdog
2+
on:
3+
pull_request:
4+
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.head_ref }}
7+
cancel-in-progress: true
8+
9+
jobs:
10+
reviewdog:
11+
name: 🐶 Reviewdog
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- uses: reviewdog/action-setup@v1
17+
with:
18+
reviewdog_version: latest
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: "^1.17.0"
24+
25+
- name: Install golangci-lint
26+
run:
27+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.0
28+
29+
- name: Reviewdog
30+
env:
31+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run:
33+
$(go env GOPATH)/bin/golangci-lint run --out-format line-number | reviewdog -f=golangci-lint -name=golangci-lint -reporter=github-pr-review

.golangci.yml

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,38 @@ run:
3636
tests: true
3737

3838
linters:
39-
disable-all: true
40-
enable:
41-
- asciicheck
42-
- bodyclose
43-
- deadcode
44-
- dogsled
45-
- dupl
46-
- errcheck
47-
- gci
48-
- goconst
49-
- gocritic
50-
- gocyclo
51-
- godot
52-
- gofmt
53-
- gofumpt
54-
- goimports
55-
- goprintffuncname
56-
- gosec
57-
- gosimple
58-
- govet
59-
- ineffassign
60-
- misspell
61-
- prealloc
62-
- revive
63-
- staticcheck
64-
- structcheck
65-
- unconvert
66-
- unparam
67-
- unused
68-
- varcheck
39+
enable-all: true
40+
disable:
41+
- wrapcheck
42+
- varnamelen
43+
- thelper
44+
- tagliatelle
45+
- paralleltest
46+
- nlreturn
47+
- exhaustivestruct
48+
- wsl
49+
- goerr113
50+
- golint
51+
- gochecknoglobals
52+
- scopelint
53+
- funlen
54+
- lll
55+
- maligned
56+
- gomnd
57+
- godox
58+
- interfacer
6959
issues:
70-
exclude:
71-
- 'G404:' # math/rand usage
72-
- "don't use an underscore in package name"
60+
exclude-rules:
61+
- linters:
62+
- stylecheck
63+
text: "ST1003:" # should not use underscores in package names
64+
- linters:
65+
- revive
66+
text: "don't use an underscore in package name"
67+
- linters:
68+
- gocritic
69+
text: "commentFormatting"
70+
- path: _test\.go
71+
linters:
72+
- gosec
73+
- testpackage # makes you use a separate _test package

CONTRIBUTING.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,24 @@ Go best-practices.
77

88
### Required environmental variables
99

10-
The tests require at least two environment variables: `STREAM_CHAT_API_KEY` and `STREAM_CHAT_API_SECRET`. There are multiple ways to provide that:
11-
- simply set it in your current shell (`export STREAM_CHAT_API_KEY=xyz`)
10+
The tests require at least two environment variables: `STREAM_KEY` and `STREAM_SECRET`. There are multiple ways to provide that:
11+
- simply set it in your current shell (`export STREAM_KEY=xyz`)
1212
- you could use [direnv](https://direnv.net/)
1313
- if you debug the tests in VS Code, you can set up an env file there as well: `"go.testEnvFile": "${workspaceFolder}/.env"`.
1414

1515
### Code formatting & linter
1616

17-
We enforce code formatting with [`gufumpt`](https://github.com/mvdan/gofumpt) (a stricter `gofmt`). If you use VS Code, it's recommended to set this setting there for auto-formatting:
17+
We enforce code formatting with [`gofumpt`](https://github.com/mvdan/gofumpt) (a stricter `gofmt`). If you use VS Code, it's recommended to set this setting there for auto-formatting:
1818

1919
```json
2020
"editor.formatOnSave": true,
2121
"gopls": {
2222
"formatting.gofumpt": true
23-
}
23+
},
24+
"go.lintTool": "golangci-lint",
25+
"go.lintFlags": [
26+
"--fast"
27+
]
2428
```
2529

2630
Gofumpt will mostly take care of your linting issues as well.

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
GOLANGCI_VERSION = 1.44.0
2+
GOLANGCI = vendor/golangci-lint/$(GOLANGCI_VERSION)/golangci-lint
3+
4+
install-golangci:
5+
test -s $(GOLANGCI) || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(dir $(GOLANGCI)) v$(GOLANGCI_VERSION)
6+
7+
lint: install-golangci
8+
$(GOLANGCI) run

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ import (
4343
stream "github.com/GetStream/stream-chat-go/v4"
4444
)
4545

46-
var APIKey = os.Getenv("STREAM_CHAT_API_KEY")
47-
var APISecret = os.Getenv("STREAM_CHAT_API_SECRET")
46+
var APIKey = os.Getenv("STREAM_KEY")
47+
var APISecret = os.Getenv("STREAM_SECRET")
4848
var userID = "" // your server user id
4949

5050
func main() {

app.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package stream_chat //nolint: golint
1+
package stream_chat
22

33
import (
44
"context"

app_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package stream_chat //nolint: golint
1+
package stream_chat
22

33
import (
44
"context"

async_tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package stream_chat //nolint: golint
1+
package stream_chat
22

33
import (
44
"context"

0 commit comments

Comments
 (0)