From 53c7b4f8a33e0cd685bbf07f437727dd2de10e87 Mon Sep 17 00:00:00 2001 From: Gonzalo Peci Date: Tue, 14 Dec 2021 19:47:47 +0100 Subject: [PATCH 1/4] Migrate to Go 1.16 and GitHub Actions --- .github/workflows/go.yml | 25 +++++ .gitignore | 15 +-- .travis.yml | 36 ------- Gopkg.lock | 203 --------------------------------------- Gopkg.toml | 23 ----- README.md | 28 +++++- VERSION | 2 +- go.mod | 20 ++++ go.sum | 73 ++++++++++++++ 9 files changed, 147 insertions(+), 278 deletions(-) create mode 100644 .github/workflows/go.yml delete mode 100644 .travis.yml delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml new file mode 100644 index 0000000..a4021c0 --- /dev/null +++ b/.github/workflows/go.yml @@ -0,0 +1,25 @@ +name: Go + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 + + - name: Build + run: go build -v ./... + + - name: Test + run: go test -v ./... diff --git a/.gitignore b/.gitignore index 57d375d..b7e1247 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ -!lib -# Created by https://www.gitignore.io/api/go -# Edit at https://www.gitignore.io/?templates=go - -### Go ### +### Go # Binaries for programs and plugins *.exe *.exe~ @@ -10,14 +6,11 @@ *.so *.dylib -# Test binary, build with `go test -c` +# Test binary, built with `go test -c` *.test # Output of the go coverage tool, specifically when used with LiteIDE *.out -### Go Patch ### -/vendor/ -/Godeps/ - -# End of https://www.gitignore.io/api/go +# Dependency directories (remove the comment below to include it) +# vendor/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4724473..0000000 --- a/.travis.yml +++ /dev/null @@ -1,36 +0,0 @@ -language: go -go: - - "1.11" - -branches: - only: - - master - -before_script: - # Download the binary to bin folder in $GOPATH - - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep - # Make the binary executable - - chmod +x $GOPATH/bin/dep - -script: - - make compile - -after_success: - - if [ $(git tag -l "$(cat VERSION)") ]; then echo "Version already exists" && false; fi - -before_deploy: - - git config --local user.name "TravisCI" - - git config --local user.email "TravisCI" - - git tag "$(cat VERSION)" - -deploy: - provider: releases - api_key: - secure: hDEakaIFo+J/R66MUqY8LoXmu2k0AHp1/KZXQtb0M7jJBA+89z7I/xUFr7qKZ0Zo2whv0LPRxmhHuI5T3S28BMHbT5/arq2wLqubjMO29xhpmCuZiFMA/JyI6t1lRIhlijc1Yt81sJeC/2kPYGnayR+NmDRNgyZ4aTANfi+xh8cOUFrR1NMnInRKus7+QqUzNZetuH+xMMSq9oRt42ooSN8+PyWOMR48eAiomKkAqE0683HWw1f9FfhxM9o+t/n0ARqkRSBHRGg7hy6L1PFK23mq65a2VaB5qwI63899YcZ1m8jOoX+PVT6oAzDKNSEH8SDe+Mc9QaLmqgkcwfTrqZKrsNkrpLGTB1Jzf9GvfKBSlRnI1geLEJeV9pqZDy0i7Lb1sa5X7Vl4cYzJTvVfRwGVntj37v1FthY5YEOkaCYd1jVLHMUsIuZ1rZsiyjtL5gO12jvxUb0vkY75njERiY+xgV+QBp8wwAcYnMcTYEOsKF7hBjnWrLjSDpSU7pv/FdGTZaZlgoKj8ibbNo2YShHdPdXvWqJh/FRj9eTtyhxyuxrF9CX0ne0356Ptc+v3dl1Q7zMnwXjWgCPN9nCMLRSlfWxAAL96zRLfm5It8+MwIYm32L2rFW77OdDI3t4Ebt1meGwOJAQSvJMfDuH7Okot95u1d+2dCqOWhHRN2Lg= - file: bin/loro - skip_cleanup: true - on: - repo: pecigonzalo/loro - -env: - - DEP_VERSION="0.5.0" diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index a2c239e..0000000 --- a/Gopkg.lock +++ /dev/null @@ -1,203 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - name = "github.com/aws/aws-sdk-go" - packages = [ - "aws", - "aws/awserr", - "aws/awsutil", - "aws/client", - "aws/client/metadata", - "aws/corehandlers", - "aws/credentials", - "aws/credentials/ec2rolecreds", - "aws/credentials/endpointcreds", - "aws/credentials/processcreds", - "aws/credentials/stscreds", - "aws/csm", - "aws/defaults", - "aws/ec2metadata", - "aws/endpoints", - "aws/request", - "aws/session", - "aws/signer/v4", - "internal/ini", - "internal/sdkio", - "internal/sdkrand", - "internal/sdkuri", - "internal/shareddefaults", - "private/protocol", - "private/protocol/json/jsonutil", - "private/protocol/jsonrpc", - "private/protocol/query", - "private/protocol/query/queryutil", - "private/protocol/rest", - "private/protocol/xml/xmlutil", - "service/cloudwatchlogs", - "service/sts" - ] - revision = "6d55516ad2946220d9e26804f224c1c215f293ea" - version = "v1.16.17" - -[[projects]] - name = "github.com/fatih/color" - packages = ["."] - revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4" - version = "v1.7.0" - -[[projects]] - name = "github.com/fsnotify/fsnotify" - packages = ["."] - revision = "c2828203cd70a50dcccfb2761f8b1f8ceef9a8e9" - version = "v1.4.7" - -[[projects]] - name = "github.com/hashicorp/golang-lru" - packages = [ - ".", - "simplelru" - ] - revision = "20f1fb78b0740ba8c3cb143a61e86ba5c8669768" - version = "v0.5.0" - -[[projects]] - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/printer", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token" - ] - revision = "8cb6e5b959231cc1119e43259c4a608f9c51a241" - version = "v1.0.0" - -[[projects]] - name = "github.com/inconshreveable/mousetrap" - packages = ["."] - revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75" - version = "v1.0" - -[[projects]] - name = "github.com/jmespath/go-jmespath" - packages = ["."] - revision = "c2b33e84" - -[[projects]] - name = "github.com/magiconair/properties" - packages = ["."] - revision = "c2353362d570a7bfa228149c62842019201cfb71" - version = "v1.8.0" - -[[projects]] - name = "github.com/mattn/go-colorable" - packages = ["."] - revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" - version = "v0.0.9" - -[[projects]] - name = "github.com/mattn/go-isatty" - packages = ["."] - revision = "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c" - version = "v0.0.4" - -[[projects]] - name = "github.com/mitchellh/go-homedir" - packages = ["."] - revision = "ae18d6b8b3205b561c79e8e5f69bff09736185f4" - version = "v1.0.0" - -[[projects]] - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "3536a929edddb9a5b34bd6861dc4a9647cb459fe" - version = "v1.1.2" - -[[projects]] - name = "github.com/pelletier/go-toml" - packages = ["."] - revision = "c01d1270ff3e442a8a57cddc1c92dc1138598194" - version = "v1.2.0" - -[[projects]] - name = "github.com/segmentio/events" - packages = ["."] - revision = "e62248bd4df28ce3b028d5d557cec210098797c1" - version = "v2.2.0" - -[[projects]] - name = "github.com/spf13/afero" - packages = [ - ".", - "mem" - ] - revision = "a5d6946387efe7d64d09dcba68cdd523dc1273a3" - version = "v1.2.0" - -[[projects]] - name = "github.com/spf13/cast" - packages = ["."] - revision = "8c9545af88b134710ab1cd196795e7f2388358d7" - version = "v1.3.0" - -[[projects]] - name = "github.com/spf13/cobra" - packages = ["."] - revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385" - version = "v0.0.3" - -[[projects]] - name = "github.com/spf13/jwalterweatherman" - packages = ["."] - revision = "4a4406e478ca629068e7768fc33f3f044173c0a6" - version = "v1.0.0" - -[[projects]] - name = "github.com/spf13/pflag" - packages = ["."] - revision = "298182f68c66c05229eb03ac171abe6e309ee79a" - version = "v1.0.3" - -[[projects]] - name = "github.com/spf13/viper" - packages = ["."] - revision = "6d33b5a963d922d182c91e8a1c88d81fd150cfd4" - version = "v1.3.1" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix"] - revision = "48ac38b7c8cbedd50b1613c0fccacfc7d88dfcdf" - -[[projects]] - name = "golang.org/x/text" - packages = [ - "internal/gen", - "internal/triegen", - "internal/ucd", - "transform", - "unicode/cldr", - "unicode/norm" - ] - revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" - version = "v0.3.0" - -[[projects]] - name = "gopkg.in/yaml.v2" - packages = ["."] - revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" - version = "v2.2.2" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - inputs-digest = "37af28ca8ad8fcac8ce723832ccc6018f7ce2805bf41194bda38789d6481c4e9" - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index 32d2033..0000000 --- a/Gopkg.toml +++ /dev/null @@ -1,23 +0,0 @@ -# Gopkg.toml example -# -# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md -# for detailed Gopkg.toml documentation. -# - - - -[[constraint]] - name = "github.com/mitchellh/go-homedir" - version = "1.0.0" - -[[constraint]] - name = "github.com/spf13/cobra" - version = "0.0.3" - -[[constraint]] - name = "github.com/spf13/viper" - version = "1.2.1" - -[prune] - go-tests = true - unused-packages = true diff --git a/README.md b/README.md index df04c9a..aa0010f 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,64 @@ # loro + ## Loro Only Repeats Output -![](https://media.giphy.com/media/5PSPV1ucLX31u/giphy-downsized.gif) + +![loro](https://media.giphy.com/media/5PSPV1ucLX31u/giphy-downsized.gif) ## What? + **loro** is a CLI to query AWS CloudWatch-Logs groups, streams and events. ## Why? + Sometimes you just want to tail some logs. ## How? + ### Get logs + Get logs for a streamgroup: + ``` loro get /streamgroup/ ``` + Select a single stream: + ``` loro get /streamgroup/ -p stream ``` + Print raw logs: + ``` loro get -r /streamgroup/ ``` + Tail a log: + ``` loro get -f /streamgroup/ ``` ### Find streams or groups + List streams + ``` loro list streams /streamgroup/ ``` + List groups: + ``` loro list groups /streamgroup/partialname ``` ### Get help + All commands contain help documentation by using `--help` flag -``` + +```bash > loro get --help Get logs from a group or stream @@ -61,15 +80,16 @@ Global Flags: ``` #### Inspiration and Sources + - https://github.com/segmentio/cwlogs - https://github.com/jorgebastida/awslogs - https://github.com/mmcquillan/lawsg #### Notes + Why create a new piece of software? -- `segmentio/cwlogs` Is great, not only a big inspiration for LORO but also a big part of the lib codebase was forked from them. But, its built for supporting segment.io log format and while that makes sense and works great, its not generic enought for many other cases or supporting other log formats +- `segmentio/cwlogs` Is great, not only a big inspiration for LORO but also a big part of the lib codebase was forked from them. But, its built for supporting segment.io log format and while that makes sense and works great, its not generic enought for many other cases or supporting other log formats - `jorgebastida/awslogs` I believe binary distribution is better for this tool and golang is a more powerfull and faster language when dealing with many logs - Hence it made sense to separate the repository, but I still would like to credit again `segmentio/cwlogs` and the Segment team for their work as it provides the base for this software. diff --git a/VERSION b/VERSION index d917d3e..b1e80bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.2 +0.1.3 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..54e50df --- /dev/null +++ b/go.mod @@ -0,0 +1,20 @@ +module pecigonzalo/loro + +go 1.16 + +require ( + github.com/BurntSushi/toml v0.4.1 // indirect + github.com/aws/aws-sdk-go v1.16.17 + github.com/fatih/color v1.7.0 + github.com/hashicorp/golang-lru v0.5.0 + github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/mattn/go-colorable v0.0.9 // indirect + github.com/mattn/go-isatty v0.0.4 // indirect + github.com/mitchellh/go-homedir v1.0.0 + github.com/pecigonzalo/loro v0.0.0-20190114225731-87642e962926 + github.com/segmentio/events v2.1.0+incompatible + github.com/spf13/afero v1.2.0 // indirect + github.com/spf13/cobra v0.0.3 + github.com/spf13/viper v1.3.1 + golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..c9693d6 --- /dev/null +++ b/go.sum @@ -0,0 +1,73 @@ +github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= +github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aws/aws-sdk-go v1.16.17 h1:hHRKZhoB4qEY17aGNp71UxQFyYpx6WZXGMUzx9y/A4w= +github.com/aws/aws-sdk-go v1.16.17/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= +github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +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/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +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/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +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/mitchellh/go-homedir v1.0.0 h1:vKb8ShqSby24Yrqr/yDYkuFz8d0WUjys40rvnGC8aR0= +github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/pecigonzalo/loro v0.0.0-20190114225731-87642e962926 h1:iQBPreFqYC+vuShxyZcBMu5NZi0Hk3wniOtThyZZy5I= +github.com/pecigonzalo/loro v0.0.0-20190114225731-87642e962926/go.mod h1:tzYn5nFco7ovmqu6cECvNbWfpGxLpIL/Qqw8uatJeWs= +github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/segmentio/events v2.1.0+incompatible h1:7ns47dgRJMt/JgIXrNU0MiD/NtCGa55lKzWP15dcGnM= +github.com/segmentio/events v2.1.0+incompatible/go.mod h1:npQUbmKYO33tlRpaQNZjgD2mXv0fb2hbOH0CNVs6g2Y= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/afero v1.2.0 h1:O9FblXGxoTc51M+cqr74Bm2Tmt4PvkA5iu/j8HrkNuY= +github.com/spf13/afero v1.2.0/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= +github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.3 h1:ZlrZ4XsMRm04Fr5pSFxBgfND2EBVa1nLpiy1stUsX/8= +github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.1 h1:5+8j8FTpnFV4nEImW/ofkzEt8VoOiLXxdYIDsB73T38= +github.com/spf13/viper v1.3.1/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= +golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da h1:b3NXsE2LusjYGGjL5bxEVZZORm/YEFFrWFjR8eFrw/c= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +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 9cba2374a229187f6c74c515fafcdadb542942dd Mon Sep 17 00:00:00 2001 From: Gonzalo Peci Date: Tue, 14 Dec 2021 19:51:47 +0100 Subject: [PATCH 2/4] fixup! Migrate to Go 1.16 and GitHub Actions --- .github/workflows/go.yml | 4 ++-- README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index a4021c0..b56312c 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,9 +2,9 @@ name: Go on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: diff --git a/README.md b/README.md index aa0010f..e6ad3ae 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ loro list groups /streamgroup/partialname All commands contain help documentation by using `--help` flag -```bash +``` > loro get --help Get logs from a group or stream From 7b23d239358dc3fb08f01dd8c1059353a9fcae50 Mon Sep 17 00:00:00 2001 From: Gonzalo Peci Date: Tue, 14 Dec 2021 19:52:36 +0100 Subject: [PATCH 3/4] Remove Makefile --- Makefile | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 Makefile diff --git a/Makefile b/Makefile deleted file mode 100644 index a332931..0000000 --- a/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# https://azer.bike/journal/a-good-makefile-for-go/ - -# Go related variables. -GOFILES=$(wildcard *.go) -PROJECTNAME=$(shell basename "$(PWD)") - -## compile: Compile the binary. -compile: go-compile - -## clean: Clean build files. Runs `go clean` internally. -clean: go-clean - -go-compile: go-clean dep-ensure go-test go-build - -go-build: - @echo " > Building binary..." - go build -o bin/$(PROJECTNAME) $(GOFILES) - -dep-ensure: - @echo " > Checking if there is any missing dependencies..." - dep ensure -v -vendor-only - -go-clean: - @echo " > Cleaning build cache" - go clean - -go-test: - @echo " > Running tests" - go test -v - -.PHONY: help -all: help -help: Makefile - @echo - @echo " Choose a command run in "$(PROJECTNAME)":" - @echo - @sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /' - @echo From f9032972e7ad3d48f8a853f8a1fb93d465547921 Mon Sep 17 00:00:00 2001 From: Gonzalo Peci Date: Tue, 14 Dec 2021 20:01:14 +0100 Subject: [PATCH 4/4] Use GoReleaser --- .github/workflows/go.yml | 35 ++++++++++++++++++++++++----------- .gitignore | 2 ++ .goreleaser.yml | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 .goreleaser.yml diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index b56312c..0cb1008 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -2,24 +2,37 @@ name: Go on: push: + tags: + - '*' branches: [ main ] pull_request: branches: [ main ] -jobs: +permissions: + contents: write - build: +jobs: + goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.16 + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.16 - - name: Build - run: go build -v ./... + - name: Test + run: go test -v ./... - - name: Test - run: go test -v ./... + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index b7e1247..9f4a567 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +dist/ diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 0000000..6f8696c --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,32 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + # you may remove this if you don't need go generate + - go generate ./... +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin +archives: + - replacements: + darwin: Darwin + linux: Linux + windows: Windows + 386: i386 + amd64: x86_64 +checksum: + name_template: 'checksums.txt' +snapshot: + name_template: "{{ incpatch .Version }}-next" +changelog: + sort: asc + filters: + exclude: + - '^docs:' + - '^test:'