From 0bdb3d8fc67536a2eb819741246c1ba740212ea0 Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:32:21 +0900 Subject: [PATCH 1/6] update longcat and go version to 1.19 --- go.mod | 17 +++++++++++------ go.sum | 38 +++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index f44ddb4..e2c7067 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,17 @@ module github.com/Doarakko/bigburger -go 1.13 +go 1.19 require ( - github.com/mattn/go-sixel v0.0.1 - github.com/mattn/longcat v0.0.1 + github.com/mattn/go-sixel v0.0.2 + github.com/mattn/longcat v0.0.4 github.com/rakyll/statik v0.1.7 - golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 + golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 +) + +require ( + github.com/disintegration/imaging v1.6.2 // indirect + github.com/soniakeys/quant v1.0.0 // indirect + golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 // indirect + golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect ) diff --git a/go.sum b/go.sum index 0c4ff33..c291277 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,16 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c= github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4= +github.com/eliukblau/pixterm v1.3.1/go.mod h1:on5ueknFt+ZFVvIVVzQ7/JXwPjv5fJd8Q1Ybh7XixfU= github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e/go.mod h1:kLgvv7o6UM+0QSf0QjAse3wReFDsb9qbZJdfexWlrQw= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-sixel v0.0.1 h1:rhJSpux2xjsmXdXqY694uiEC0Rwxt6jYoq7Bahqo2xs= -github.com/mattn/go-sixel v0.0.1/go.mod h1:zlzhYSuMbLdRdrxfutExxGpC+Pf2uUTJ6GpVQ4LB5dc= -github.com/mattn/longcat v0.0.1 h1:ExyQ1ZAr/DxxZLD7QEyHqfP34P/bs5Jv7ue2C5IkDXk= -github.com/mattn/longcat v0.0.1/go.mod h1:sUG/u32l+8LdKQmUGi49ju0kN5Eq2ozAwAgazcnjzbM= -github.com/mattn/pixterm v1.2.5-0.20191008162044-72ff621ffbff/go.mod h1:vTyMUJdLhdKEPZWDo6JxMHiCnqzi6BgELKw7qnCLrqo= +github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-sixel v0.0.2 h1:dpqJDkqA5rwLZjyIEuzdXiWBeqKc6GaA1NgoG9X0/gk= +github.com/mattn/go-sixel v0.0.2/go.mod h1:h2Sss+DiUEHy0pUqcIB6PFXo5Cy8sTQEFr3a9/5ZLNw= +github.com/mattn/longcat v0.0.4 h1:r16ULTdBdNFmcDd29q8wo05HtTrcPIi6s3yIQKe83cg= +github.com/mattn/longcat v0.0.4/go.mod h1:HjC6ojjSHzsSZPoxyybfD3+bmmwAcXLGIxwNDi3N4n4= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= @@ -20,23 +21,22 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/tomnomnom/xtermcolor v0.0.0-20160428124646-b78803f00a7e/go.mod h1:fSIW/szJHsRts/4U8wlMPhs+YqJC+7NYR+Qqb1uJVpA= github.com/zyxar/image2ascii v0.0.0-20180912034614-460a04e371ae/go.mod h1:Md4Hcw0pmYWDCo1o/fHeOC2Gdhc6oDRwLim8V+SMvI0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200221231518-2aa609cf4a9d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= -golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20191206065243-da761ea9ff43/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc= +golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From becc5d6aa5a62fc68b74f6bcbf85770dc1e9bca3 Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:34:29 +0900 Subject: [PATCH 2/6] fmt --- main.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 6aaf29e..4366102 100644 --- a/main.go +++ b/main.go @@ -17,12 +17,13 @@ import ( "strings" "time" - "golang.org/x/term" - //_ "./statik" - _ "github.com/Doarakko/bigburger/statik" "github.com/mattn/go-sixel" "github.com/mattn/longcat/iterm" "github.com/rakyll/statik/fs" + "golang.org/x/term" + + // _ "./statik" + _ "github.com/Doarakko/bigburger/statik" ) // Topping struct @@ -119,14 +120,14 @@ func main() { flag.IntVar(&nBurger, "n", 1, "number of big burger") flag.Float64Var(&rInterval, "i", 1.0, "rate of intervals") flag.StringVar(&fileName, "o", "", "output image file") - flag.BoolVar(&sesame, "s", false,"buns with sesame") + flag.BoolVar(&sesame, "s", false, "buns with sesame") for i := 0; i < len(toppings); i++ { flag.IntVar(&toppings[i].Count, toppings[i].Option, toppings[i].Count, fmt.Sprintf("how many %s", toppings[i].Name)) } flag.Parse() - if sesame{ + if sesame { top = topWithSesame } From df03c45a72796b2af24a9d699f0c61263755e6ea Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:34:42 +0900 Subject: [PATCH 3/6] add badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index db76fd1..66442f0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # bigburger +[![Go Reference](https://pkg.go.dev/badge/github.com/Doarakko/bigburger.svg)](https://pkg.go.dev/github.com/Doarakko/bigburger) +[![Go Report Card](https://goreportcard.com/badge/github.com/Doarakko/bigburger)](https://goreportcard.com/report/github.com/Doarakko/bigburger) + Biiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiig burger! ![sample](./sample.gif) From e023d05225467696750dcf04a70248fab5b5186a Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:35:01 +0900 Subject: [PATCH 4/6] add golangcliint to github-actions --- .github/workflows/golangci-lint.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 0000000..057d2af --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,19 @@ +name: golangci-lint +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: golangci-lint + uses: golangci/golangci-lint-action@v2 + with: + version: v1.29 From abb1828e3314c32a9b054820e778f7fea2bbe731 Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:38:47 +0900 Subject: [PATCH 5/6] specify goversion on golangcilint --- .github/workflows/golangci-lint.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index 057d2af..e3ea2ea 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -12,8 +12,9 @@ jobs: name: lint runs-on: ubuntu-latest steps: + - uses: actions/setup-go@v3 + with: + go-version: 1.19 - uses: actions/checkout@v2 - name: golangci-lint uses: golangci/golangci-lint-action@v2 - with: - version: v1.29 From 87f9e94db05074499aba841cb6e126beea06565c Mon Sep 17 00:00:00 2001 From: peperoncino <2wua4nlyi@gmail.com> Date: Thu, 19 Jan 2023 00:43:24 +0900 Subject: [PATCH 6/6] use os.writefile --- main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4366102..9fd7102 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,6 @@ import ( "image" "image/draw" "image/png" - "io/ioutil" "log" "net/http" "os" @@ -50,7 +49,8 @@ func saveImage(filename string, img image.Image) error { if err != nil { return err } - return ioutil.WriteFile(filename, buf.Bytes(), 0644) + + return os.WriteFile(filename, buf.Bytes(), 0644) } var toppings [6]Topping