From 0295ae6001af91a7c93967990d9e9312fc7df926 Mon Sep 17 00:00:00 2001 From: Clivern Date: Tue, 8 Jan 2019 23:10:24 +0100 Subject: [PATCH 1/8] switch from dep to go modules --- .travis.yml | 5 +- Gopkg.lock | 253 ---------------------------------------------------- Gopkg.toml | 62 ------------- Makefile | 12 --- beaver.go | 3 +- go.mod | 28 ++++++ go.sum | 47 ++++++++++ 7 files changed, 80 insertions(+), 330 deletions(-) delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.travis.yml b/.travis.yml index daef4311..9a423ce7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,9 @@ go: - 1.11.x - master +env: + - GO111MODULE=on + install: true # Fix this by renaming the directory before testing. @@ -23,9 +26,7 @@ script: - cd clivern/beaver - mv config.travis.yml config.test.yml # Config & execute ci tasks - - make install_dep - make install_revive - - make ensure_dep - cp config.yml config.dist.yml - make ci diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index 5e1cb850..00000000 --- a/Gopkg.lock +++ /dev/null @@ -1,253 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - digest = "1:9f3b30d9f8e0d7040f729b82dcbc8f0dead820a133b3147ce355fc451f32d761" - name = "github.com/BurntSushi/toml" - packages = ["."] - pruneopts = "UT" - revision = "3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005" - version = "v0.3.1" - -[[projects]] - digest = "1:b520b55fc1146c5b0eea03b07233f7a3d4a9be985c037c91ea6b82ecb81bd521" - name = "github.com/bitly/go-simplejson" - packages = ["."] - pruneopts = "UT" - revision = "aabad6e819789e569bd6aabf444c935aa9ba1e44" - version = "v0.5.0" - -[[projects]] - branch = "master" - digest = "1:5771b86b64a5e64d8e3d70337813686586210131ac4fb4c6a97b43c8e25e2253" - name = "github.com/dgrijalva/jwt-go" - packages = ["."] - pruneopts = "UT" - revision = "3af4c746e1c248ee8491a3e0c6f7a9cd831e95f8" - -[[projects]] - digest = "1:abeb38ade3f32a92943e5be54f55ed6d6e3b6602761d74b4aab4c9dd45c18abd" - name = "github.com/fsnotify/fsnotify" - packages = ["."] - pruneopts = "UT" - revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" - version = "v1.4.7" - -[[projects]] - digest = "1:2cd7915ab26ede7d95b8749e6b1f933f1c6d5398030684e6505940a10f31cfda" - name = "github.com/ghodss/yaml" - packages = ["."] - pruneopts = "UT" - revision = "0ca9ea5df5451ffdf184b4428c902747c2c11cd7" - version = "v1.0.0" - -[[projects]] - branch = "master" - digest = "1:36fe9527deed01d2a317617e59304eb2c4ce9f8a24115bcc5c2e37b3aee5bae4" - name = "github.com/gin-contrib/sse" - packages = ["."] - pruneopts = "UT" - revision = "22d885f9ecc78bf4ee5d72b937e4bbcdc58e8cae" - -[[projects]] - digest = "1:d5083934eb25e45d17f72ffa86cae3814f4a9d6c073c4f16b64147169b245606" - name = "github.com/gin-gonic/gin" - packages = [ - ".", - "binding", - "json", - "render", - ] - pruneopts = "UT" - revision = "b869fe1415e4b9eb52f247441830d502aece2d4d" - version = "v1.3.0" - -[[projects]] - digest = "1:34a9a60fade37f8009ed4a19e02924198aba3eabfcc120ee5c6002b7de17212d" - name = "github.com/go-redis/redis" - packages = [ - ".", - "internal", - "internal/consistenthash", - "internal/hashtag", - "internal/pool", - "internal/proto", - "internal/singleflight", - "internal/util", - ] - pruneopts = "UT" - revision = "b3d9bf10f6666b2ee5100a6f3f84f4caf3b4e37d" - version = "v6.14.2" - -[[projects]] - digest = "1:97df918963298c287643883209a2c3f642e6593379f97ab400c2a2e219ab647d" - name = "github.com/golang/protobuf" - packages = ["proto"] - pruneopts = "UT" - revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" - version = "v1.2.0" - -[[projects]] - branch = "master" - digest = "1:aff61b46ef326e4a211e69245a0ca03dee77f850b6221d3fd0f5bc9208591734" - name = "github.com/google/logger" - packages = ["."] - pruneopts = "UT" - revision = "324a7c096a0d1041e2766b42187908af70e4f723" - -[[projects]] - branch = "master" - digest = "1:521455a43b348afa7e4deb79c471f3ed8ff04a71d7d9b88ab0d149b9eb905fe2" - name = "github.com/gorilla/websocket" - packages = ["."] - pruneopts = "UT" - revision = "95ba29eb981bbb27d92e1f70bf8a1949452d926b" - -[[projects]] - digest = "1:ea40c24cdbacd054a6ae9de03e62c5f252479b96c716375aace5c120d68647c8" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token", - ] - pruneopts = "UT" - revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" - version = "v1.0.0" - -[[projects]] - digest = "1:8eb1de8112c9924d59bf1d3e5c26f5eaa2bfc2a5fcbb92dc1c2e4546d695f277" - name = "github.com/imdario/mergo" - packages = ["."] - pruneopts = "UT" - revision = "9f23e2d6bd2a77f959b2bf6acdbefd708a83a4a4" - version = "v0.3.6" - -[[projects]] - digest = "1:3e551bbb3a7c0ab2a2bf4660e7fcad16db089fdcfbb44b0199e62838038623ea" - name = "github.com/json-iterator/go" - packages = ["."] - pruneopts = "UT" - revision = "1624edc4454b8682399def8740d46db5e4362ba4" - version = "v1.1.5" - -[[projects]] - digest = "1:0981502f9816113c9c8c4ac301583841855c8cf4da8c72f696b3ebedf6d0e4e5" - name = "github.com/mattn/go-isatty" - packages = ["."] - pruneopts = "UT" - revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c" - version = "v0.0.4" - -[[projects]] - branch = "master" - digest = "1:e2fd456541de3991d3965eab6083e9f4234e384e6dcb6587e375f1942b96163b" - name = "github.com/micro/go-config" - packages = [ - ".", - "encoder", - "encoder/hcl", - "encoder/json", - "encoder/toml", - "encoder/xml", - "encoder/yaml", - "loader", - "loader/memory", - "reader", - "reader/json", - "source", - "source/file", - ] - pruneopts = "UT" - revision = "1bf51c5c888a67d4ddf8d3e447bf4e9a6e2453da" - -[[projects]] - digest = "1:33422d238f147d247752996a26574ac48dcf472976eda7f5134015f06bf16563" - name = "github.com/modern-go/concurrent" - packages = ["."] - pruneopts = "UT" - revision = "bacd9c7ef1dd9b15be4a9909b8ac7a4e313eec94" - version = "1.0.3" - -[[projects]] - digest = "1:e32bdbdb7c377a07a9a46378290059822efdce5c8d96fe71940d87cb4f918855" - name = "github.com/modern-go/reflect2" - packages = ["."] - pruneopts = "UT" - revision = "4b7aa43c6742a2c18fdef89dd197aaae7dac7ccd" - version = "1.0.1" - -[[projects]] - branch = "master" - digest = "1:398b067cd5b79e0a0c067f5b3a23cf369567d93de8e4d9bf364fda4382b51f63" - name = "github.com/nbio/st" - packages = ["."] - pruneopts = "UT" - revision = "e9e8d9816f3268def6dcbd2dea03301f40e9de94" - -[[projects]] - branch = "master" - digest = "1:a3b8912deeef29007fab9a13a9f21b9e9b59c621a2ed61e2fe7b37320a71fbd5" - name = "github.com/satori/go.uuid" - packages = ["."] - pruneopts = "UT" - revision = "b2ce2384e17bbe0c6d34077efa39dbab3e09123b" - -[[projects]] - digest = "1:03aa6e485e528acb119fb32901cf99582c380225fc7d5a02758e08b180cb56c3" - name = "github.com/ugorji/go" - packages = ["codec"] - pruneopts = "UT" - revision = "b4c50a2b199d93b13dc15e78929cfb23bfdf21ab" - version = "v1.1.1" - -[[projects]] - branch = "master" - digest = "1:a8b1900d94a9d18b13087127110d3ba80db6063a0d7957ebf5599ab3fcf4d895" - name = "golang.org/x/sys" - packages = [ - "unix", - "windows", - "windows/registry", - "windows/svc/eventlog", - ] - pruneopts = "UT" - revision = "b4a75ba826a64a70990f11a225237acd6ef35c9f" - -[[projects]] - digest = "1:cbc72c4c4886a918d6ab4b95e347ffe259846260f99ebdd8a198c2331cf2b2e9" - name = "gopkg.in/go-playground/validator.v8" - packages = ["."] - pruneopts = "UT" - revision = "5f1438d3fca68893a817e4a66806cea46a9e4ebf" - version = "v8.18.2" - -[[projects]] - digest = "1:4d2e5a73dc1500038e504a8d78b986630e3626dc027bc030ba5c75da257cdb96" - name = "gopkg.in/yaml.v2" - packages = ["."] - pruneopts = "UT" - revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" - version = "v2.2.2" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/dgrijalva/jwt-go", - "github.com/gin-gonic/gin", - "github.com/go-redis/redis", - "github.com/google/logger", - "github.com/gorilla/websocket", - "github.com/micro/go-config", - "github.com/nbio/st", - "github.com/satori/go.uuid", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 6a0ca30e..00000000 --- a/Gopkg.toml +++ /dev/null @@ -1,62 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html -# for detailed Gopkg.toml documentation. -# -# required = ["github.com/user/thing/cmd/thing"] -# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] -# -# [[constraint]] -# name = "github.com/user/project" -# version = "1.0.0" -# -# [[constraint]] -# name = "github.com/user/project2" -# branch = "dev" -# source = "github.com/myfork/project2" -# -# [[override]] -# name = "github.com/x/y" -# version = "2.4.0" -# -# [prune] -# non-go = false -# go-tests = true -# unused-packages = true - - -[[constraint]] - name = "github.com/gin-gonic/gin" - version = "1.3.0" - -[[constraint]] - name = "github.com/go-redis/redis" - version = "v6.14.1" - -[prune] - go-tests = true - unused-packages = true - -[[constraint]] - branch = "master" - name = "github.com/google/logger" - -[[constraint]] - branch = "master" - name = "github.com/gorilla/websocket" - -[[constraint]] - branch = "master" - name = "github.com/satori/go.uuid" - -[[constraint]] - branch = "master" - name = "github.com/dgrijalva/jwt-go" - -[[constraint]] - branch = "master" - name = "github.com/nbio/st" - -[[constraint]] - branch = "master" - name = "github.com/micro/go-config" diff --git a/Makefile b/Makefile index 4cea09e8..a7df491e 100644 --- a/Makefile +++ b/Makefile @@ -9,18 +9,6 @@ install_revive: $(GO) get github.com/mgechev/revive -## install_dep: Install dep v0.5.0. -install_dep: - @echo ">> Install dep v0.5.0" - curl https://raw.githubusercontent.com/golang/dep/v0.5.0/install.sh | sh - - -## ensure_dep: Install all dependencies. -ensure_dep: - @echo ">> Install all dependencies" - dep ensure - - ## style: Check code style. style: @echo ">> checking code style" diff --git a/beaver.go b/beaver.go index 3b8fe8cf..d172b599 100644 --- a/beaver.go +++ b/beaver.go @@ -16,6 +16,7 @@ import ( "io" "net/http" "os" + "strconv" ) func main() { @@ -49,7 +50,7 @@ func main() { return } - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) if config.Get("app", "mode").String("dev") == "prod" { gin.SetMode(gin.ReleaseMode) diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..b753ef90 --- /dev/null +++ b/go.mod @@ -0,0 +1,28 @@ +module github.com/clivern/beaver + +require ( + github.com/BurntSushi/toml v0.3.1 + github.com/bitly/go-simplejson v0.5.0 + github.com/dgrijalva/jwt-go v0.0.0-20180921172315-3af4c746e1c2 + github.com/fsnotify/fsnotify v1.4.7 + github.com/ghodss/yaml v1.0.0 + github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 + github.com/gin-gonic/gin v1.3.0 + github.com/go-redis/redis v6.14.2+incompatible + github.com/golang/protobuf v1.2.0 + github.com/google/logger v0.0.0-20181112113803-324a7c096a0d + github.com/gorilla/websocket v0.0.0-20181206070239-95ba29eb981b + github.com/hashicorp/hcl v1.0.0 + github.com/imdario/mergo v0.3.6 + github.com/json-iterator/go v1.1.5 + github.com/mattn/go-isatty v0.0.4 + github.com/micro/go-config v0.13.1 + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd + github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 + github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 + github.com/satori/go.uuid v0.0.0-20181028125025-b2ce2384e17b + github.com/ugorji/go v1.1.1 + golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 + gopkg.in/go-playground/validator.v8 v8.18.2 + gopkg.in/yaml.v2 v2.2.2 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..4c298715 --- /dev/null +++ b/go.sum @@ -0,0 +1,47 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= +github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v0.0.0-20180921172315-3af4c746e1c2 h1:xhptajUY6xeFJmfsrpVPxXxH0i2JxobVCBDn0iShbkU= +github.com/dgrijalva/jwt-go v0.0.0-20180921172315-3af4c746e1c2/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7 h1:AzN37oI0cOS+cougNAV9szl6CVoj2RYwzS3DpUQNtlY= +github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= +github.com/gin-gonic/gin v1.3.0 h1:kCmZyPklC0gVdL728E6Aj20uYBJV93nj/TkwBTKhFbs= +github.com/gin-gonic/gin v1.3.0/go.mod h1:7cKuhb5qV2ggCFctp2fJQ+ErvciLZrIeoOSOm6mUr7Y= +github.com/go-redis/redis v6.14.2+incompatible h1:UE9pLhzmWf+xHNmZsoccjXosPicuiNaInPgym8nzfg0= +github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= +github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/logger v0.0.0-20181112113803-324a7c096a0d h1:1YC9w0bRU6LRB8JEapVhbfB2Iiewl2NsX39p8uxrKbk= +github.com/google/logger v0.0.0-20181112113803-324a7c096a0d/go.mod h1:tQN+I/DyBt051hEHNEzPgIeyy/GD1WJaKbqPScoDKdY= +github.com/gorilla/websocket v0.0.0-20181206070239-95ba29eb981b h1:SCMPL/pS3OPUJDW7FpTje/+eIJEhdBLxaG2iUl3Gkcw= +github.com/gorilla/websocket v0.0.0-20181206070239-95ba29eb981b/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= +github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/micro/go-config v0.13.1 h1:xuiOe3F6QjBOr4dRu6VNfZo7/yfck8coXBFyEL+YxCk= +github.com/micro/go-config v0.13.1/go.mod h1:fVecLls1kW+EJsrlkJYqUmVoJa1epSHhsPMDXppELx0= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4= +github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms= +github.com/satori/go.uuid v0.0.0-20181028125025-b2ce2384e17b h1:8O/3dJ2dGfuLVN0bo2B0IdkG0L8cjpmFJ4r8eRQBCi8= +github.com/satori/go.uuid v0.0.0-20181028125025-b2ce2384e17b/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/ugorji/go v1.1.1 h1:gmervu+jDMvXTbcHQ0pd2wee85nEoE0BsVyEuzkfK8w= +github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6 h1:IcgEB62HYgAhX0Nd/QrVgZlxlcyxbGQHElLUhW2X4Fo= +golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/go-playground/validator.v8 v8.18.2 h1:lFB4DoMU6B626w8ny76MV7VX6W2VHct2GVOI3xgiMrQ= +gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From e9779f5aed001c6c937092991e10cf03299e91db Mon Sep 17 00:00:00 2001 From: "A. F" Date: Tue, 8 Jan 2019 23:48:04 +0100 Subject: [PATCH 2/8] Drop 1.9.x and 1.10.x support from travisCI --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a423ce7..bda35af0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,8 +4,6 @@ services: - redis-server go: - - 1.9.x - - 1.10.x - 1.11.x - master From 3be2c3f7717cab418ee1fd5df61a7edb25d1f79a Mon Sep 17 00:00:00 2001 From: "A. F" Date: Wed, 9 Jan 2019 00:33:08 +0100 Subject: [PATCH 3/8] Add 1.9.x and 1.10.x in allowed failures list --- .travis.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bda35af0..241c25b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,8 @@ services: - redis-server go: + - 1.9.x + - 1.10.x - 1.11.x - master @@ -27,4 +29,10 @@ script: - make install_revive - cp config.yml config.dist.yml - make ci - + +matrix: + include: + allow_failures: + - go: 1.9.x + - go: 1.10.x + From 52dbe24356b141514bf569171f4632f7a1fc8b7d Mon Sep 17 00:00:00 2001 From: "A. F" Date: Wed, 9 Jan 2019 02:07:26 +0100 Subject: [PATCH 4/8] auto release binaries with TravisCI --- .travis.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 241c25b5..f377899e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ language: go +# needed for the nfpm pipe +addons: + apt: + packages: + - rpm + services: - redis-server @@ -29,10 +35,25 @@ script: - make install_revive - cp config.yml config.dist.yml - make ci - + # Workaround to clear any package used for testing only + - git status + - git diff > diff.log + - cat diff.log + - git clean -fd + - git reset --hard + matrix: include: allow_failures: - go: 1.9.x - go: 1.10.x - + +deploy: +- provider: script + skip_cleanup: true + script: curl -sL http://git.io/goreleaser | bash + on: + tags: true + go: 1.11.x + condition: $TRAVIS_OS_NAME = linux + From d0263c7a256e3d363d43e3ce99ebb8c443f6dc81 Mon Sep 17 00:00:00 2001 From: Clivern Date: Wed, 9 Jan 2019 13:40:29 +0100 Subject: [PATCH 5/8] update goreleaser.yml --- .goreleaser.yml | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index f4b7139f..1b341ebd 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,17 +1,6 @@ -# goreleaser release --skip-publish --snapshot -build: - goos: - - linux - - darwin - - windows - goarch: - - 386 - - amd64 - - arm - - arm64 - ignore: - - goos: darwin - goarch: 386 +builds: +- env: + - CGO_ENABLED=0 archive: replacements: darwin: Darwin @@ -19,24 +8,13 @@ archive: windows: Windows 386: i386 amd64: x86_64 - format_overrides: - - goos: windows - format: zip -brew: - github: - owner: clivern - name: beaver - folder: Formula - homepage: https://github.com/clivern/beaver - description: A Real Time Messaging Server - dependencies: - - git -nfpm: - homepage: https://github.com/clivern/beaver - description: A Real Time Messaging Server - maintainer: A.F - vendor: Beaver - formats: - - deb - dependencies: - - git \ No newline at end of file +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ .Tag }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:' From 631a6cc30e245bc6b544e7b3ce74547cda8b7444 Mon Sep 17 00:00:00 2001 From: Clivern Date: Wed, 9 Jan 2019 15:19:29 +0100 Subject: [PATCH 6/8] Fix port issue --- internal/app/api/channel_test.go | 3 ++- internal/app/api/client_test.go | 3 ++- internal/app/api/config_test.go | 3 ++- internal/app/cmd/health_test.go | 3 ++- internal/app/controller/channel_test.go | 3 ++- internal/app/controller/client_test.go | 3 ++- internal/app/controller/config_test.go | 3 ++- internal/app/controller/health_check_test.go | 3 ++- internal/app/controller/home_test.go | 3 ++- internal/app/controller/metrics_test.go | 3 ++- internal/app/controller/node_test.go | 3 ++- internal/app/controller/socket_test.go | 3 ++- internal/app/driver/redis_test.go | 3 ++- internal/pkg/logger/logger_test.go | 3 ++- internal/pkg/utils/validator_test.go | 3 ++- 15 files changed, 30 insertions(+), 15 deletions(-) diff --git a/internal/app/api/channel_test.go b/internal/app/api/channel_test.go index 4d1a5c7b..239e4ba1 100644 --- a/internal/app/api/channel_test.go +++ b/internal/app/api/channel_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" "time" ) @@ -29,7 +30,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestChannelAPI test cases diff --git a/internal/app/api/client_test.go b/internal/app/api/client_test.go index 5801c417..647ffcb2 100644 --- a/internal/app/api/client_test.go +++ b/internal/app/api/client_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" "time" ) @@ -29,7 +30,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestClientAPI test cases diff --git a/internal/app/api/config_test.go b/internal/app/api/config_test.go index 93064b20..b0372b2e 100644 --- a/internal/app/api/config_test.go +++ b/internal/app/api/config_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" ) @@ -28,7 +29,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestConfigAPI test cases diff --git a/internal/app/cmd/health_test.go b/internal/app/cmd/health_test.go index 74c5cb53..7cb7187c 100644 --- a/internal/app/cmd/health_test.go +++ b/internal/app/cmd/health_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" ) @@ -28,7 +29,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestHealthStatus test cases diff --git a/internal/app/controller/channel_test.go b/internal/app/controller/channel_test.go index 20fd6f52..70bf6090 100644 --- a/internal/app/controller/channel_test.go +++ b/internal/app/controller/channel_test.go @@ -13,6 +13,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "strings" "testing" "time" @@ -34,7 +35,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestGetChannel1 test case diff --git a/internal/app/controller/client_test.go b/internal/app/controller/client_test.go index 72dff77f..d7f8db99 100644 --- a/internal/app/controller/client_test.go +++ b/internal/app/controller/client_test.go @@ -13,6 +13,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "strings" "testing" "time" @@ -34,7 +35,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestGetClient1 test case diff --git a/internal/app/controller/config_test.go b/internal/app/controller/config_test.go index 9bae96c7..13cb2814 100644 --- a/internal/app/controller/config_test.go +++ b/internal/app/controller/config_test.go @@ -13,6 +13,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "strings" "testing" ) @@ -33,7 +34,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestGetConfig1 test case diff --git a/internal/app/controller/health_check_test.go b/internal/app/controller/health_check_test.go index 9e409e36..12c7921f 100644 --- a/internal/app/controller/health_check_test.go +++ b/internal/app/controller/health_check_test.go @@ -12,6 +12,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "testing" ) @@ -31,7 +32,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestHealthCheckController test case diff --git a/internal/app/controller/home_test.go b/internal/app/controller/home_test.go index 8d10b06c..b4432e0f 100644 --- a/internal/app/controller/home_test.go +++ b/internal/app/controller/home_test.go @@ -12,6 +12,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "testing" ) @@ -31,7 +32,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestHomeController test case diff --git a/internal/app/controller/metrics_test.go b/internal/app/controller/metrics_test.go index 4fdc2fc4..477cf8cc 100644 --- a/internal/app/controller/metrics_test.go +++ b/internal/app/controller/metrics_test.go @@ -12,6 +12,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "testing" ) @@ -31,7 +32,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestMetricsController test case diff --git a/internal/app/controller/node_test.go b/internal/app/controller/node_test.go index 69df23a9..c7c33f46 100644 --- a/internal/app/controller/node_test.go +++ b/internal/app/controller/node_test.go @@ -12,6 +12,7 @@ import ( "net/http" "net/http/httptest" "os" + "strconv" "testing" ) @@ -31,7 +32,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestNodeController test case diff --git a/internal/app/controller/socket_test.go b/internal/app/controller/socket_test.go index 6038e306..25da938b 100644 --- a/internal/app/controller/socket_test.go +++ b/internal/app/controller/socket_test.go @@ -12,6 +12,7 @@ import ( _ "net/http" _ "net/http/httptest" "os" + "strconv" _ "testing" ) @@ -31,5 +32,5 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } diff --git a/internal/app/driver/redis_test.go b/internal/app/driver/redis_test.go index 4827ea18..00e6f6f8 100644 --- a/internal/app/driver/redis_test.go +++ b/internal/app/driver/redis_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" ) @@ -28,7 +29,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestRedisDriver test cases diff --git a/internal/pkg/logger/logger_test.go b/internal/pkg/logger/logger_test.go index c113f76d..6ca891b5 100644 --- a/internal/pkg/logger/logger_test.go +++ b/internal/pkg/logger/logger_test.go @@ -10,6 +10,7 @@ import ( "github.com/nbio/st" "io/ioutil" "os" + "strconv" "strings" "testing" "time" @@ -31,7 +32,7 @@ func init() { } os.Setenv("BeaverBasePath", fmt.Sprintf("%s/", basePath)) - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestLogging test cases diff --git a/internal/pkg/utils/validator_test.go b/internal/pkg/utils/validator_test.go index 58935e92..9232a9c6 100644 --- a/internal/pkg/utils/validator_test.go +++ b/internal/pkg/utils/validator_test.go @@ -9,6 +9,7 @@ import ( "github.com/micro/go-config" "github.com/nbio/st" "os" + "strconv" "testing" ) @@ -27,7 +28,7 @@ func init() { )) } - os.Setenv("PORT", config.Get("app", "port").String("8080")) + os.Setenv("PORT", strconv.Itoa(config.Get("app", "port").Int(8080))) } // TestValidation test cases From c09a7a342035d86c27b38eda3e64ffbc3177be7f Mon Sep 17 00:00:00 2001 From: Clivern Date: Wed, 9 Jan 2019 23:27:04 +0100 Subject: [PATCH 7/8] Update README and Dockerfile --- Dockerfile | 4 ---- README.md | 21 ++++++++------------- docker-compose.yml | 2 +- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 24d54287..f256cb96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,11 @@ FROM golang:1.11.1 -RUN curl https://raw.githubusercontent.com/golang/dep/v0.5.0/install.sh | sh - RUN mkdir -p /go/src/github.com/clivern/beaver/ ADD . /go/src/github.com/clivern/beaver/ WORKDIR /go/src/github.com/clivern/beaver -RUN dep ensure - RUN go build -o beaver beaver.go EXPOSE 8080 diff --git a/README.md b/README.md index 15bc6e77..92e6bb28 100644 --- a/README.md +++ b/README.md @@ -10,19 +10,7 @@ Beaver is a real-time messaging server. With beaver you can easily build scalabl ### Config & Run The Application -Beaver uses [dep](https://github.com/golang/dep) to manage dependencies so you need to install it - -```bash -# For latest dep version -$ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - -# For latest stable version -$ curl https://raw.githubusercontent.com/golang/dep/v0.5.0/install.sh | sh - -$ dep ensure -``` - -Then Create a dist config file. +Beaver uses [Go Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies. First Create a dist config file. ```bash $ cp config.yml config.dist.yml @@ -65,6 +53,13 @@ $ ./beaver -config=/custom/path/config.dist.yml $ go run beaver.go -config=/custom/path/config.dist.yml ``` +Or [download a pre-built Beaver binary](https://github.com/Clivern/Beaver/releases) for your operating system. + +```bash +curl -sL https://github.com/Clivern/Beaver/releases/download/x.x.x/beaver_x.x.x_OS.tar.gz | tar xz +./beaver -config=config.dist.yml +``` + Also running beaver with docker still an option. ```bash diff --git a/docker-compose.yml b/docker-compose.yml index c4290e9c..f0f7ee2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: - 'redis_data:/data' restart: always web: - image: "clivern_beaver:1.0.0" + image: "clivern_beaver:1.1.0" build: . command: './beaver' ports: From f3dfb32c7e882e9870db8918ed014c623424b9f9 Mon Sep 17 00:00:00 2001 From: Clivern Date: Wed, 9 Jan 2019 23:34:46 +0100 Subject: [PATCH 8/8] Bump version to 1.1.0 --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 92e6bb28..0ae42751 100644 --- a/README.md +++ b/README.md @@ -312,12 +312,19 @@ Socket("ws://localhost:8080/ws/$ID/$TOKEN"); [![Build Status](https://travis-ci.org/Clivern/Beaver.svg?branch=master)](https://travis-ci.org/Clivern/Beaver) [![GitHub license](https://img.shields.io/github/license/Clivern/Beaver.svg)](https://github.com/Clivern/Beaver/blob/master/LICENSE) -[![Version](https://img.shields.io/badge/Version-1.0.0-red.svg)](https://github.com/Clivern/Beaver/releases) +[![Version](https://img.shields.io/badge/Version-1.1.0-red.svg)](https://github.com/Clivern/Beaver/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/Clivern/Beaver)](https://goreportcard.com/report/github.com/Clivern/Beaver) ## Changelog +* Version 1.1.0: +``` +Switch to go 1.11 modules. +Use goreleaser to deliver pre-built binaries. +Upgrade dependencies. +``` + * Version 1.0.0: ``` Initial Release.