Skip to content

Commit 5b0d21d

Browse files
committed
restructed project folders, added goreleaser
1 parent 8431e5a commit 5b0d21d

File tree

22 files changed

+155
-65
lines changed

22 files changed

+155
-65
lines changed

.github/workflows/go.yml

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

.github/workflows/goreleaser.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: goreleaser
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
env:
15+
DOCKER_CLI_EXPERIMENTAL: "enabled"
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v1
24+
25+
- name: Docker Login
26+
uses: docker/login-action@v1
27+
with:
28+
username: ${{ secrets.DOCKERHUB_USERNAME }}
29+
password: ${{ secrets.DOCKERHUB_TOKEN }}
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v2
33+
with:
34+
go-version: 1.16
35+
36+
- name: Run GoReleaser
37+
uses: goreleaser/goreleaser-action@v2
38+
with:
39+
version: latest
40+
args: release --rm-dist
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313

1414
# Dependency directories (remove the comment below to include it)
1515
vendor/
16+
dist/

.goreleaser.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
before:
2+
hooks:
3+
- go mod tidy
4+
- go generate ./...
5+
builds:
6+
- main: ./cmd/binance-proxy
7+
env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- linux
11+
- windows
12+
- darwin
13+
goarch:
14+
- amd64
15+
- arm
16+
- arm64
17+
archives:
18+
- replacements:
19+
darwin: Darwin
20+
linux: Linux
21+
windows: Windows
22+
amd64: x86_64
23+
checksum:
24+
name_template: 'checksums.txt'
25+
snapshot:
26+
name_template: "{{ incpatch .Version }}-next"
27+
changelog:
28+
sort: asc
29+
filters:
30+
exclude:
31+
- '^docs:'
32+
- '^test:'
33+
34+
dockers:
35+
-
36+
image_templates: ["docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-amd64"]
37+
dockerfile: Dockerfile
38+
use: buildx
39+
build_flag_templates:
40+
- --platform=linux/amd64
41+
- --label=org.opencontainers.image.title={{ .ProjectName }}
42+
- --label=org.opencontainers.image.description={{ .ProjectName }}
43+
- --label=org.opencontainers.image.url=https://github.com/nightshift2k/{{ .ProjectName }}
44+
- --label=org.opencontainers.image.source=https://github.com/nightshift2k/{{ .ProjectName }}
45+
- --label=org.opencontainers.image.version={{ .Version }}
46+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
47+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
48+
- --label=org.opencontainers.image.licenses=MIT
49+
-
50+
image_templates: ["docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-arm64v8"]
51+
goarch: arm64
52+
dockerfile: Dockerfile
53+
use: buildx
54+
build_flag_templates:
55+
- --platform=linux/arm64/v8
56+
- --label=org.opencontainers.image.title={{ .ProjectName }}
57+
- --label=org.opencontainers.image.description={{ .ProjectName }}
58+
- --label=org.opencontainers.image.url=https://github.com/nightshift2k/{{ .ProjectName }}
59+
- --label=org.opencontainers.image.source=https://github.com/nightshift2k/{{ .ProjectName }}
60+
- --label=org.opencontainers.image.version={{ .Version }}
61+
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
62+
- --label=org.opencontainers.image.revision={{ .FullCommit }}
63+
- --label=org.opencontainers.image.licenses=MIT
64+
docker_manifests:
65+
- name_template: docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}
66+
image_templates:
67+
- docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-amd64
68+
- docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-arm64v8
69+
- name_template: docker.io/nightshift2k/{{ .ProjectName }}:latest
70+
image_templates:
71+
- docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-amd64
72+
- docker.io/nightshift2k/{{ .ProjectName }}:{{ .Version }}-arm64v8

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM alpine
2+
COPY binance-proxy /usr/local/bin/binance-proxy
3+
ENTRYPOINT ["/usr/local/bin/binance-proxy"]

src/binance-proxy/main.go renamed to cmd/binance-proxy/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"binance-proxy/handler"
5-
"binance-proxy/service"
4+
"binance-proxy/internal/handler"
5+
"binance-proxy/internal/service"
66
"context"
77
"flag"
88
"net/http"

go.mod

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module binance-proxy
2+
3+
go 1.16
4+
5+
require (
6+
github.com/adshao/go-binance/v2 v2.3.1
7+
github.com/sirupsen/logrus v1.8.1
8+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac
9+
)
10+
11+
require (
12+
github.com/bitly/go-simplejson v0.5.0 // indirect
13+
github.com/gorilla/websocket v1.4.2 // indirect
14+
github.com/stretchr/objx v0.2.0 // indirect
15+
github.com/stretchr/testify v1.4.0 // indirect
16+
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef // indirect
17+
gopkg.in/yaml.v2 v2.2.4 // indirect
18+
)

src/binance-proxy/go.sum renamed to go.sum

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,19 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
2020
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
2121
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
2222
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
23-
github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
24-
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
23+
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
24+
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
2525
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
2626
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
27-
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
2827
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
29-
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
28+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
29+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
3030
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
31-
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
32-
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
31+
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef h1:fPxZ3Umkct3LZ8gK9nbk+DWDJ9fstZa2grBn+lWVKPs=
32+
golang.org/x/sys v0.0.0-20211004093028-2c5d950f24ef/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
33+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
34+
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
35+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
36+
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
37+
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
38+
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
File renamed without changes.

src/binance-proxy/handler/handler.go renamed to internal/handler/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package handler
22

33
import (
4-
"binance-proxy/service"
4+
"binance-proxy/internal/service"
55
"context"
66
"net/http"
77
"net/http/httputil"
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/binance-proxy/service/depth.go renamed to internal/service/depth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package service
22

33
import (
4-
"binance-proxy/tool"
4+
"binance-proxy/internal/tool"
55
"context"
66
"sync"
77
"time"

src/binance-proxy/service/exchangeinfo.go renamed to internal/service/exchangeinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"sync"
88
"time"
99

10-
"binance-proxy/tool"
10+
"binance-proxy/internal/tool"
1111

1212
log "github.com/sirupsen/logrus"
1313
)

src/binance-proxy/service/kline.go renamed to internal/service/kline.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package service
22

33
import (
4-
"binance-proxy/tool"
4+
"binance-proxy/internal/tool"
55
"container/list"
66
"context"
77
"net/http"
File renamed without changes.
File renamed without changes.

src/binance-proxy/service/ticker.go renamed to internal/service/ticker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package service
22

33
import (
4-
"binance-proxy/tool"
4+
"binance-proxy/internal/tool"
55
"context"
66
"sync"
77

File renamed without changes.

src/binance-proxy/go.mod

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

0 commit comments

Comments
 (0)