Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have a question #100

Open
wants to merge 384 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
384 commits
Select commit Hold shift + click to select a range
7d6bf66
update copyright
chengshiwen Apr 3, 2020
f1f48a8
add testcase for influxql
chengshiwen Apr 3, 2020
5fc5e2c
optimizate testcase for influxql
chengshiwen Apr 4, 2020
37cd39e
refactor query code
chengshiwen Apr 7, 2020
f0107ba
rename QueryCluster to Query in circle
chengshiwen Apr 7, 2020
91f31d3
support log_enabled configuration in proxy.json
chengshiwen Apr 7, 2020
1b4de0c
optimizate influxql.go
chengshiwen Apr 7, 2020
812fac4
fix query error: slice bounds out of range
chengshiwen Apr 7, 2020
8cc47eb
optimizate code in circle.go
chengshiwen Apr 7, 2020
f42a8d3
update to 2.4.5
chengshiwen Apr 8, 2020
c5a9464
add test script
chengshiwen Apr 10, 2020
21d21ae
add HttpTimeout config
chengshiwen Apr 10, 2020
c9fc9ac
return json body when query or write error occured
chengshiwen Apr 12, 2020
4fd331d
optimizate error message of auth and method check
chengshiwen Apr 14, 2020
a928640
optimizate backend code
chengshiwen Apr 21, 2020
8464325
support to rewrite after startup
chengshiwen Apr 21, 2020
e6ee8fa
fix EOF problem when reading meta data
chengshiwen Apr 21, 2020
216b8d7
fix rewrite problem when read file error occured
chengshiwen Apr 21, 2020
8512200
fix rewrite problem: 'index out of range'
chengshiwen Apr 21, 2020
5424493
update test script
chengshiwen Apr 21, 2020
95b2954
optimizate db check
chengshiwen Apr 21, 2020
c3490fe
update to 2.4.6
chengshiwen Apr 21, 2020
0053405
fix db name with unescaped characters when writing data
chengshiwen Apr 22, 2020
bbebb5e
move version constant to service/http.go
chengshiwen Apr 24, 2020
1b1e97a
remove config package and add the config items into proxy.json
chengshiwen Apr 27, 2020
6be71d4
update readme
chengshiwen Apr 27, 2020
1819670
format code style with go fmt
chengshiwen Apr 27, 2020
9f8f177
remove .editorconfig
chengshiwen Apr 27, 2020
c814a4a
support: make fmt
chengshiwen Apr 28, 2020
14ea42f
optimizate lines in migrate function
chengshiwen Apr 28, 2020
f525fe5
modify log output when writing data
chengshiwen May 8, 2020
b76557e
optimizate config load and check
chengshiwen May 8, 2020
313eb8f
optimizate log output
chengshiwen May 11, 2020
4d01f09
support field's multiple data type
chengshiwen May 11, 2020
0b2164a
replace map set by golang-set
chengshiwen May 12, 2020
a4fef8a
update readme
chengshiwen May 12, 2020
83b8c73
update to 2.4.7
chengshiwen May 12, 2020
c3aeb21
optimizate log output in WriteData
chengshiwen Jul 2, 2020
f749fe8
fix leading space problem when writing data
chengshiwen Jul 6, 2020
e0955f3
replace compress/gzip by klauspost/pgzip
chengshiwen Jul 29, 2020
022c299
print version info after startup
chengshiwen Jul 29, 2020
703bc95
remove locks and use channel
chengshiwen Jul 31, 2020
e92a984
refactor code
chengshiwen Jul 31, 2020
003c919
add ants pool to improve performance of flush buffer
chengshiwen Jul 31, 2020
6062f0f
optimizate function: GetKey and GetBackends
chengshiwen Aug 2, 2020
201b6e3
add go module
chengshiwen Aug 2, 2020
7a7c6b2
update go mod, makefile and readme
chengshiwen Aug 3, 2020
3ec7115
support to write backslashes in field value and add test cases
chengshiwen Aug 5, 2020
2b87aad
optimizate LineData to LinePoint in point.go
chengshiwen Aug 5, 2020
c915131
update test cases and scripts
chengshiwen Aug 5, 2020
9f97d63
add benchmark in point_test.go
chengshiwen Aug 5, 2020
f23c4f1
refactor code
chengshiwen Aug 6, 2020
db9c828
update to 2.5.0
chengshiwen Aug 6, 2020
59c932f
add router caches
chengshiwen Aug 7, 2020
3f02907
optimizate ScanKey and GetKey
chengshiwen Aug 7, 2020
c1c7fc4
optimizate ScanKey, AppendNano and RapidCheck
chengshiwen Aug 8, 2020
ce238be
optimizate runtime.growslice in Proxy.Write
chengshiwen Aug 8, 2020
ec76eaa
optimizate HandlerWrite
chengshiwen Aug 8, 2020
7e73a97
rename point to lineproto
chengshiwen Aug 8, 2020
aa284a0
vet and fix codes
chengshiwen Aug 9, 2020
f201759
optimizate NewTransport
chengshiwen Aug 9, 2020
9e45c06
add config.go
chengshiwen Aug 9, 2020
246f167
refactor config
chengshiwen Aug 10, 2020
51e1828
refactor backend to backend.go, http.go and file.go
chengshiwen Aug 11, 2020
804f149
add auth_secure in BackendConfig
chengshiwen Aug 11, 2020
1ea5c1b
optimizate codes of circle and backend
chengshiwen Aug 11, 2020
340e8d4
simplify receivers
chengshiwen Aug 11, 2020
6488fbd
separate migration codes to transfer package
chengshiwen Aug 12, 2020
1bed932
fix transfer problem
chengshiwen Aug 12, 2020
5feb9c5
optimize broadcasting resyncing and transferring
chengshiwen Aug 12, 2020
bd7ab41
uniform variables
chengshiwen Aug 12, 2020
d71ac41
fix to query transferring circle
chengshiwen Aug 12, 2020
ef01906
uniform circle fields in json
chengshiwen Aug 12, 2020
a569e2b
update to 2.5.1
chengshiwen Aug 12, 2020
d221bed
golangci-lint checked
chengshiwen Aug 13, 2020
ec3a5fe
remove vnode_size
chengshiwen Aug 13, 2020
25f0d48
update query.sh and optimize reduceByValues
chengshiwen Aug 14, 2020
9a2e37f
optimize mapset.Set
chengshiwen Aug 14, 2020
27f21c4
add write_tracing and query_tracing
chengshiwen Aug 17, 2020
a13fdc5
optimize response write
chengshiwen Aug 17, 2020
4130eb4
remove newline in log printf and modify status code of error response
chengshiwen Aug 17, 2020
ce0dd21
optimize HandlerQuery, remove log_enabled, and update query error
chengshiwen Aug 17, 2020
8058936
refactor errors.new
chengshiwen Aug 17, 2020
fc9ae63
rename VERSION to Version
chengshiwen Aug 17, 2020
a6d1ad9
improve performance of cluster query
chengshiwen Aug 18, 2020
2df1cee
fix request race problem in proxy query
chengshiwen Aug 18, 2020
02c8d90
improve performance of health api
chengshiwen Aug 18, 2020
01c3113
improve performance of measurement total stats in transfer
chengshiwen Aug 18, 2020
50c2e18
add batch query parameter for transfer http api
chengshiwen Aug 18, 2020
821a4d6
fix concurrent map problem in routerCaches
chengshiwen Aug 19, 2020
d70a86a
improve performance of transfer core function
chengshiwen Aug 19, 2020
b7f119a
optimize NewRequest to NewQueryRequest
chengshiwen Aug 20, 2020
6c397d1
support to create databases before transfer
chengshiwen Aug 20, 2020
624b597
support to batch query and improve performance of write in transfer
chengshiwen Aug 20, 2020
6e2d0e0
update to 2.5.2
chengshiwen Aug 21, 2020
a005686
refactor some code
chengshiwen Aug 22, 2020
dcde77b
refactor query parameter to tick in resync api
chengshiwen Aug 22, 2020
ac884f2
support limit parameter in transfer
chengshiwen Aug 22, 2020
9d35841
refactor msg parameter to text in encrypt and decrypt api
chengshiwen Aug 22, 2020
390afe6
remove golang-set
chengshiwen Aug 22, 2020
9930f28
optimize cleanup in backend/file.go
chengshiwen Aug 22, 2020
468473c
support query and write retry in transfer
chengshiwen Aug 22, 2020
7ceb880
support extended index in hash_key
chengshiwen Aug 23, 2020
d779c59
update query.sh
chengshiwen Aug 24, 2020
4b8d65b
refactor db parameter to dbs in rebalance, recovery and resync api
chengshiwen Aug 24, 2020
7893978
update go.mod and go.sum
chengshiwen Aug 24, 2020
ea3657d
update to 2.5.3
chengshiwen Aug 24, 2020
12e29d2
update makefile and go module
chengshiwen Sep 3, 2020
3c4a46b
update version info after startup
chengshiwen Sep 3, 2020
cb6b2bd
refactor query request clone
chengshiwen Sep 8, 2020
f444873
update makefile
chengshiwen Sep 8, 2020
6961e51
optimize context canceled log for parallel query
chengshiwen Sep 8, 2020
ae0e246
optimize query policy
chengshiwen Sep 8, 2020
1f8e632
refactor query in parallel
chengshiwen Sep 8, 2020
9226975
add active field for circle health
chengshiwen Sep 21, 2020
6c8b492
pick optimal circle when fallback
chengshiwen Sep 21, 2020
a41429e
update to 2.5.4
chengshiwen Sep 21, 2020
ca0a54e
fix precision problem when transfer json number to float64
chengshiwen Sep 27, 2020
da0aea9
improve performance of time parse in transfer
chengshiwen Sep 27, 2020
e4039c5
optimize jsoniter unmarshal in result
chengshiwen Sep 27, 2020
3dcb81a
optimize /health api and add healthy field
chengshiwen Sep 29, 2020
c2a0cc1
update http request clone function
chengshiwen Oct 23, 2020
bb29b0e
add query parameter stats for /health api
chengshiwen Oct 23, 2020
6c26a9a
update go.mod and go.sum
chengshiwen Oct 23, 2020
de01c2d
set active to false when return 500
chengshiwen Oct 23, 2020
6aa94a0
fix data race for active variable
chengshiwen Nov 19, 2020
ec6354d
fix data race for rewriting variable
chengshiwen Nov 19, 2020
5a8fe6f
fix data race in FlushBuffer
chengshiwen Nov 19, 2020
bc23de1
refactor query executor
chengshiwen Dec 2, 2020
9831b6e
rename auth_secure to auth_encrypt
chengshiwen Dec 4, 2020
d9b0f6a
update scripts
chengshiwen Dec 4, 2020
69851e3
optimize getMeasurement
chengshiwen Dec 15, 2020
c5bfb44
update go module version
chengshiwen Dec 15, 2020
28cedf7
update to 2.5.5
chengshiwen Dec 15, 2020
fe38473
update makefile
chengshiwen Dec 28, 2020
18278f8
update authors and license
chengshiwen Apr 22, 2021
3bc058e
update makefile and go module
chengshiwen Apr 22, 2021
db1ebf7
update license
chengshiwen Apr 22, 2021
29e7f62
support subquery for single measurement
chengshiwen May 17, 2021
ad23854
support configuration file with yaml/toml format
chengshiwen May 17, 2021
5340e79
fix issue #11
chengshiwen May 28, 2021
1feb850
update makefile and go module
chengshiwen May 28, 2021
0bb94f8
add workflow for go
chengshiwen Jun 2, 2021
d68e33a
add .golangci.yml and update version in makefile
chengshiwen Jun 9, 2021
b9fbd07
support retention policy to query and fix db problem when query db.rp…
shi0730 Jun 15, 2021
7b5f840
optimize retention policy query
chengshiwen Jun 15, 2021
835d7b5
add unit test for getDatabase
chengshiwen Jun 15, 2021
f02539e
optimize show retention policies
chengshiwen Jun 15, 2021
f574175
fix gzip compress error
chengshiwen Jun 15, 2021
6b8f1dc
optimize main and makefile
chengshiwen Jun 15, 2021
a16005b
add influx-tool in readme
chengshiwen Jun 15, 2021
ccd6d74
optimize body gzip reader
chengshiwen Jun 16, 2021
08e9e8f
replace klauspost/pgzip with compress/gzip
chengshiwen Jun 16, 2021
1e5ef95
forbid _internal database
chengshiwen Jun 17, 2021
bd0474a
optimize getDatabase
chengshiwen Jun 17, 2021
3e07ab0
update to 2.5.6
chengshiwen Jun 18, 2021
3733ede
add docker build and quick start
chengshiwen Sep 7, 2021
384d3ca
update go mod
chengshiwen Oct 25, 2021
1bc7952
update makefile
chengshiwen Oct 25, 2021
f7fa442
fix backslash problem in query field
chengshiwen Oct 26, 2021
0a1db8e
move write_only to backend from circle
chengshiwen Nov 23, 2021
8acf112
update ignore
chengshiwen Nov 23, 2021
5a6ca0a
support rp query parameter for /write
chengshiwen Nov 23, 2021
d2a7ee4
support rp test scripts
chengshiwen Nov 23, 2021
26f309b
add thread-safe comment for ib.buffers
chengshiwen Nov 26, 2021
adfbfa4
update readme
chengshiwen Nov 26, 2021
61b046c
update go version to 1.16
chengshiwen Nov 26, 2021
b1df191
optimize query random
chengshiwen Nov 30, 2021
13f9358
optimize query when backends unavailable
chengshiwen Dec 6, 2021
4d37963
update panjf2000/ants to 2.4.7 from 2.4.6
chengshiwen Dec 6, 2021
c7772a1
update to 2.5.7
chengshiwen Dec 6, 2021
5e51d83
fix getDatabases in transfer (#27)
chengshiwen Jan 7, 2022
c43eeea
upgrade go.mod
chengshiwen Mar 15, 2022
2a3a657
add linux/arm64 osarch
chengshiwen Mar 15, 2022
85d727a
optimize invalid format when writing empty line
chengshiwen Mar 15, 2022
9608a9d
support /api/v1/prom/write (#16)
chengshiwen Mar 22, 2022
d00cdf3
support to config write_only for backend
chengshiwen Mar 23, 2022
50dd4a5
optimize resource close
chengshiwen Mar 23, 2022
51a1aec
fix memory leak in gzip compress and parallel query
chengshiwen Mar 23, 2022
15e496c
fix index out of range in backend.attachByValues
chengshiwen Mar 24, 2022
e0d0223
optimize code
chengshiwen Mar 24, 2022
52d5e73
modify db_list to [] in example config
chengshiwen Mar 24, 2022
70fd17b
support /api/v1/prom/read
chengshiwen Mar 24, 2022
2d981e6
optimize query and form code
chengshiwen Mar 24, 2022
e7deec5
update readme
chengshiwen Mar 24, 2022
d1efb96
modify some members to private in struct
chengshiwen Mar 25, 2022
4d69951
optimize config code
chengshiwen Mar 25, 2022
92b3e77
update to 2.5.8
chengshiwen Mar 25, 2022
9ce69d5
optimize tests and query header
chengshiwen Mar 29, 2022
f6b548c
update readme
chengshiwen Mar 29, 2022
92f1558
remove unnecessary req.Body.Close()
chengshiwen Apr 8, 2022
81014e7
update readme
chengshiwen Apr 16, 2022
9696038
add common icons in readme
chengshiwen Apr 16, 2022
ebd6a50
optimize readme
chengshiwen Apr 19, 2022
4533ed7
prefer parsing db from influxql instead of query parameter
chengshiwen Apr 27, 2022
1b36d7d
optimize influxql test
chengshiwen Apr 27, 2022
95d0d33
support to parse retention policy
chengshiwen Apr 27, 2022
93aff1d
Fix prom_read to use a measurement name as a backend key as prom_writ…
matianjun1 Jul 18, 2022
acd8de6
optimize complex <db>.<rp>.<measurement> parsing
chengshiwen Jul 25, 2022
8cd5e52
support pprof_enabled to determines whether the /debug/pprof HTTP end…
chengshiwen Jul 26, 2022
fd6e571
update readme
chengshiwen Jul 26, 2022
35d72a9
add single quote influxql tests
chengshiwen Jul 26, 2022
6bf54d3
support to transfer data of all retention policies
chengshiwen Jul 26, 2022
c11be64
optimize casting string in transfer (#27)
chengshiwen Jul 26, 2022
d4b3223
update snappy to v0.0.4
chengshiwen Jul 26, 2022
8488ad8
update to 2.5.9
chengshiwen Jul 26, 2022
cbfc084
fix field value contains the newline character \n
chengshiwen Sep 8, 2022
ed9a1e7
optimize code style in influxql
chengshiwen Sep 13, 2022
ab62c5c
fix can't get measurement when measurement starts with 'select' since…
chengshiwen Sep 13, 2022
9711df3
enable _internal database
chengshiwen Sep 13, 2022
ac1a9ea
support auth token like 'Authorization: Token username:password' in h…
chengshiwen Sep 13, 2022
79ed74a
fix illegal influxql when multiple field keys are separated by commas…
chengshiwen Sep 14, 2022
236f61a
support /api/v2 interface
chengshiwen Sep 14, 2022
23f8cd1
add scripts for flux query
chengshiwen Sep 14, 2022
2a8ad10
optimize code for influql, prom and flux query
chengshiwen Sep 14, 2022
1d12a87
compat influxdb /health interface
chengshiwen Sep 14, 2022
2f27529
support cli: influx -type=flux -path-prefix=/api/v2/query
chengshiwen Sep 15, 2022
c604754
optimize serve mux and code style of service http
chengshiwen Sep 15, 2022
6202afe
optimize log output format
chengshiwen Sep 15, 2022
ac90faa
update readme
chengshiwen Sep 15, 2022
d066654
update to 2.5.10
chengshiwen Sep 15, 2022
ca33398
upgrade to Go 1.21
chengshiwen Aug 5, 2024
e8fcd43
upgrade deps version
chengshiwen Aug 5, 2024
99a9d80
optimize github workflows
chengshiwen Aug 5, 2024
8791a8d
use revive instead of golint and fix lint warning
chengshiwen Aug 5, 2024
32a0386
support ping_auth_enabled #65
chengshiwen Aug 5, 2024
3af7a0c
fix read length error: EOF #67
chengshiwen Aug 6, 2024
5c783b0
add description for .dat and .rec file
chengshiwen Aug 7, 2024
3de56b3
use nolint:all instead of nolint:revive
chengshiwen Aug 7, 2024
5f30dee
fix vulnerability cve-2016-2183 related to ssl/tls
chengshiwen Aug 7, 2024
5f6c640
support show query with limit offset clause
chengshiwen Aug 7, 2024
22b4d8a
add tests for emoji, chinese, utf8 and unicode
chengshiwen Aug 8, 2024
0ece2fe
support prometheus monitor with /metrics
chengshiwen Aug 8, 2024
a99b8d5
improve rewrite performance by up to ~3x
chengshiwen Aug 8, 2024
60aa2aa
update docker proxy.json
chengshiwen Aug 8, 2024
3b4d723
optimize code
chengshiwen Aug 9, 2024
0661171
optimize performance in transfer query
chengshiwen Aug 9, 2024
3c118e7
remove transfer limit
chengshiwen Aug 9, 2024
c76883a
update to 2.5.11
chengshiwen Aug 9, 2024
522f407
fix WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match
chengshiwen Aug 12, 2024
b916362
support custom hash_key and shard_key
chengshiwen Aug 12, 2024
9b77e67
support query parameter tick in all transfer api
chengshiwen Aug 12, 2024
d59c447
optimize code style
chengshiwen Aug 13, 2024
43617ba
rename query parameter tick to since
chengshiwen Aug 13, 2024
35b1cbf
add tests for shard key tpl
chengshiwen Aug 13, 2024
d009d15
optimize code style
chengshiwen Aug 14, 2024
6a3da52
update readme
chengshiwen Aug 14, 2024
e89d1ce
add -benchmem flag for bench in makefile
chengshiwen Aug 14, 2024
35d7343
return err if new request's error occurs
chengshiwen Aug 15, 2024
6ce4816
update to 2.5.12
chengshiwen Aug 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.DS_Store
.dockerignore
.github/
.gitignore
.golangci.yml
.idea/
AUTHORS
LICENSE
README.md
bin/
cert/
data/
docker/
!docker/build/entrypoint.sh
log/
script/
wiki/
34 changes: 34 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Go

on:
push:
branches: [ master, branch-2.* ]
pull_request:
branches: [ master, branch-2.* ]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.21

- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --timeout 3m --config .golangci.yml

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...

- name: Vet
run: go vet ./...
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
bin
.idea/
bin/
testbk*
*.dat
*.rec
*.rec
cert/
test/
log/
wiki/
.DS_Store
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
run:
allow-parallel-runners: true
linters:
enable:
- revive
disable:
- errcheck
5 changes: 3 additions & 2 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# This the official list of Eleme authors for copyright purposes.
# This the official list of authors for copyright purposes.

# Names should be added to this file as:
# Name or Organization <email address>
# The email address is not required for organizations.

Eleme Inc.
Shell.Xu <[email protected]>
ping.liu <[email protected]>

Shiwen Cheng <[email protected]>
19 changes: 10 additions & 9 deletions LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# LICENSE
MIT License

Copyright (C) 2016 Eleme <[email protected]>
Copyright (c) 2021 Shiwen Cheng

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Expand All @@ -17,4 +17,5 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
59 changes: 45 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,26 +1,57 @@
### Makefile ---
# Makefile

## Author: Shell.Xu
## Version: $Id: Makefile,v 0.0 2017/01/17 03:44:24 shell Exp $
## Copyright: 2017, Eleme <[email protected]>
## License: MIT
## Keywords:
## X-URL:
PROGRAM := influx-proxy
VERSION := 2.5.12
LDFLAGS ?= "-s -w -X github.com/chengshiwen/influx-proxy/backend.Version=$(VERSION) -X github.com/chengshiwen/influx-proxy/backend.GitCommit=$(shell git rev-parse --short HEAD) -X 'github.com/chengshiwen/influx-proxy/backend.BuildTime=$(shell date '+%Y-%m-%d %H:%M:%S')'"
GOBUILD_ENV = GO111MODULE=on CGO_ENABLED=0
GOBUILD = go build -o bin/$(PROGRAM) -a -ldflags $(LDFLAGS)
GOX = go run github.com/mitchellh/gox
TARGETS := darwin/amd64 darwin/arm64 linux/amd64 linux/arm64 windows/amd64
DIST_DIRS := find * -maxdepth 0 -type d -exec

.PHONY: build linux cross-build release test bench run lint down tidy clean

all: build

build:
mkdir -p bin
go build -o bin/influx-proxy github.com/shell909090/influx-proxy/service
$(GOBUILD_ENV) $(GOBUILD)

linux:
GOOS=linux GOARCH=amd64 $(GOBUILD_ENV) $(GOBUILD)

cross-build: clean
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=5 -output="bin/$(PROGRAM)-$(VERSION)-{{.OS}}-{{.Arch}}/$(PROGRAM)" -osarch='$(TARGETS)' .

release: cross-build
( \
cd bin && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) cp ../proxy.json {} \; && \
$(DIST_DIRS) cp -r ../conf {} \; && \
$(DIST_DIRS) tar -zcf {}.tar.gz {} \; && \
$(DIST_DIRS) zip -r {}.zip {} \; && \
$(DIST_DIRS) rm -rf {} \; && \
sha256sum * > sha256sums.txt \
)

test:
go test -v github.com/shell909090/influx-proxy/backend
go test -v github.com/chengshiwen/influx-proxy/backend

bench:
go test -bench=. github.com/shell909090/influx-proxy/backend
go test -bench=. -benchmem -run=none github.com/chengshiwen/influx-proxy/backend

clean:
rm -rf bin
run:
go run main.go

lint:
golangci-lint run --config .golangci.yml && goimports -l -w . && go fmt ./... && go vet ./...

down:
go list ./... && go mod verify

### Makefile ends here
tidy:
rm -f go.sum && go mod tidy -v

clean:
rm -rf bin data
Loading