From acb1a3c640e55d31e1c90914f5a7794ce52d98e0 Mon Sep 17 00:00:00 2001 From: Oliver Eilhard Date: Tue, 21 Nov 2023 12:18:25 +0100 Subject: [PATCH] Clarify installation instructions (#9) This commit updates the installation instructions and the toolchain. We also update the repository to use a recent version of Go. Close #7 --- .github/workflows/release.yml | 15 +++++++-------- .github/workflows/test.yml | 10 +++++++--- .goreleaser.yml | 14 ++++++-------- LICENSE | 2 +- README.md | 12 +++++++----- cmd/imgcat/imgcat.go | 3 +-- cmd/imgls/imgls.go | 3 +-- go.mod | 2 +- 8 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2476912..089412b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,26 @@ name: Release + on: - pull_request: push: tags: - - '*' + - "v**" + jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 - with: - go-version: 1.17.x + uses: actions/setup-go@v4 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --rm-dist + args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6fe20c3..6dc3d38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,19 +1,23 @@ on: [push, pull_request] + name: Test + jobs: test: strategy: matrix: - go-version: [1.16.x, 1.17.x] + go-version: [1.20.x, 1.21.x] platform: [ubuntu-latest, windows-latest, macOS-latest] name: Run ${{ matrix.go-version }} on ${{ matrix.platform }} runs-on: ${{ matrix.platform }} steps: - name: Setup Go ${{ matrix.go-version }} - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: go-version: ${{ matrix.go-version }} + - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Test run: go test -race -v ./... diff --git a/.goreleaser.yml b/.goreleaser.yml index 844f859..b7edb52 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,14 +1,15 @@ # This is an example goreleaser.yaml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com env: - - GO111MODULE=on - CGO_ENABLED=0 + before: hooks: # you may remove this if you don't use vgo - go mod tidy + builds: -- id: imgs +- id: imgls main: ./cmd/imgls binary: imgls goos: @@ -38,19 +39,16 @@ builds: ignore: - goos: darwin goarch: 386 + checksum: name_template: '{{ .ProjectName }}_checksums.txt' + archives: - name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: i386 - amd64: x86_64 format_overrides: - goos: windows format: zip + changelog: sort: asc filters: diff --git a/LICENSE b/LICENSE index e5e168a..f02a33d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ The MIT License (MIT) -Copyright © 2012-2019 Oliver Eilhard +Copyright © 2012-2023 Oliver Eilhard Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal diff --git a/README.md b/README.md index dc0e2e9..eddb77d 100644 --- a/README.md +++ b/README.md @@ -16,21 +16,23 @@ Be sure to ![imgls](/img/imgls.png?raw=true "imgls") -# Installation +## Installation -To install `imgcat`, type: +To install `imgcat`, you should have a recent version of Go (1.21+ at the time of writing this), and type: ```go -GO111MODULE=on go get -u github.com/olivere/iterm2-imagetools/cmd/imgcat +go install github.com/olivere/iterm2-imagetools/cmd/imgcat@latest ``` To install `imgls`, type: ```go -GO111MODULE=on go get -u github.com/olivere/iterm2-imagetools/cmd/imgls +go install github.com/olivere/iterm2-imagetools/cmd/imgls@latest ``` -# License +The binaries then get installed into the `$GOPATH/bin` directory (or `$HOME/go/bin` if `GOPATH` is not set; see `go help install`), which you can add to your `$PATH`. + +## License MIT-LICENSE. See [LICENSE](http://olivere.mit-license.org/) or the LICENSE file provided in the repository for details. diff --git a/cmd/imgcat/imgcat.go b/cmd/imgcat/imgcat.go index 9dde3b0..3b27115 100644 --- a/cmd/imgcat/imgcat.go +++ b/cmd/imgcat/imgcat.go @@ -10,7 +10,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "net/http" "os" @@ -74,7 +73,7 @@ func displayLocalPicture(filename string) { } func display(r io.Reader) error { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return err } diff --git a/cmd/imgls/imgls.go b/cmd/imgls/imgls.go index f1474ad..cbe07d4 100644 --- a/cmd/imgls/imgls.go +++ b/cmd/imgls/imgls.go @@ -10,7 +10,6 @@ import ( "flag" "fmt" "io" - "io/ioutil" "log" "os" "path/filepath" @@ -57,7 +56,7 @@ func displayLocalPicture(filename string) { } func display(filename string, r io.Reader) error { - data, err := ioutil.ReadAll(r) + data, err := io.ReadAll(r) if err != nil { return err } diff --git a/go.mod b/go.mod index 5dec5a3..f52f99e 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ module github.com/olivere/iterm2-imagetools -go 1.12 +go 1.20