Skip to content

Commit

Permalink
Merge pull request #29 from apiiro/upgrade-toolchain
Browse files Browse the repository at this point in the history
Upgrade go version and toolchain version
  • Loading branch information
IgalKreich authored Sep 15, 2024
2 parents 1d11d01 + 1070b86 commit 1f4a0aa
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif
GO111MODULE=on CGO_ENABLED=0 GOARCH=amd64 $(GOCMD) build -o bin/$(BINARY_NAME)-$(shell $(GOCMD) run . --version | cut -d" " -f 3)-osx .

build-linux:
docker run --rm -v $(shell pwd):/app -w /app --platform=linux/amd64 golang:1.22-alpine /bin/sh -c "GO111MODULE=on CGO_ENABLED=0 GOARCH=amd64 $(GOCMD) build -o bin/$(BINARY_NAME)-$(shell $(GOCMD) run . --version | cut -d" " -f 3)-linux ."
docker run --rm -v $(shell pwd):/app -w /app --platform=linux/amd64 golang:1.23-alpine /bin/sh -c "GO111MODULE=on CGO_ENABLED=0 GOARCH=amd64 $(GOCMD) build -o bin/$(BINARY_NAME)-$(shell $(GOCMD) run . --version | cut -d" " -f 3)-linux ."

clean:
rm -rf ./bin
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Tool to create a git revision snapshot for an existing repository clone.

```
NAME:
git-snap - 1.21 - Create a git revision snapshot for an existing repository clone. Symbolic link files will be omitted.
git-snap - Create a git revision snapshot for an existing repository clone. Symbolic link files will be omitted.
USAGE:
git-snap --src value --rev value --out value [optional flags]
Expand Down
5 changes: 2 additions & 3 deletions git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"gitsnap/options"
"gitsnap/util"
"io"
"io/ioutil"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -272,7 +271,7 @@ func (provider *repositoryProvider) dumpFile(repository *git.Repository, name st

contentsBytes := []byte(contents)

err = ioutil.WriteFile(targetFilePath, contentsBytes, TARGET_PERMISSIONS)
err = os.WriteFile(targetFilePath, contentsBytes, TARGET_PERMISSIONS)
if err != nil {
if strings.Contains(err.Error(), "file name too long") {
return &util.ErrorWithCode{
Expand All @@ -287,7 +286,7 @@ func (provider *repositoryProvider) dumpFile(repository *git.Repository, name st

if provider.opts.CreateHashMarkers {
targetHashFilePath := fmt.Sprintf("%v.hash", targetFilePath)
err = ioutil.WriteFile(targetHashFilePath, []byte(file.Hash.String()), TARGET_PERMISSIONS)
err = os.WriteFile(targetHashFilePath, []byte(file.Hash.String()), TARGET_PERMISSIONS)
if err != nil {
log.Printf("failed to write hash file of '%v' to '%v': %v", filePath, targetFilePath, err)
}
Expand Down
3 changes: 1 addition & 2 deletions git/git_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package git
import (
"fmt"
"gitsnap/options"
"io/ioutil"
"log"
"os"
"os/exec"
Expand All @@ -32,7 +31,7 @@ func gitArchiveArgs(clonePath string, commitish string, outputFilePath string) [
}

func withTempDir(op func(string)) {
dirPath, err := ioutil.TempDir("", "")
dirPath, err := os.MkdirTemp("", "")
if err != nil {
panic(err)
}
Expand Down
9 changes: 4 additions & 5 deletions git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"gitsnap/options"
"io/fs"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
Expand All @@ -29,7 +28,7 @@ func TestGitTestSuite(t *testing.T) {

func cloneLocal(remote string, filter string) (clonePath string) {
var err error
clonePath, err = ioutil.TempDir("", "")
clonePath, err = os.MkdirTemp("", "")
if err != nil {
panic(err)
}
Expand All @@ -56,7 +55,7 @@ func (gitSuite *gitTestSuite) SetupTest() {
gitSuite.clonePath = cloneLocal(gitSuite.remote, "")
gitSuite.filteredClonePath = cloneLocal(gitSuite.remote, "--filter=blob:limit=1k")
var err error
gitSuite.outputPath, err = ioutil.TempDir("", "")
gitSuite.outputPath, err = os.MkdirTemp("", "")
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -91,7 +90,7 @@ func (gitSuite *gitTestSuite) verifyOutputPathAux(
fileSize := info.Size()
gitSuite.True(fileSize >= 0, "file at %v has invalid size", path)
gitSuite.True(info.Mode().IsRegular())
content, err := ioutil.ReadFile(path)
content, err := os.ReadFile(path)
gitSuite.Nil(err, "failed to read file at %v", path)
fileSizeFromRead := int64(len(content))
gitSuite.EqualValues(fileSize, fileSizeFromRead, "read different file size for %v", path)
Expand Down Expand Up @@ -527,7 +526,7 @@ func (gitSuite *gitTestSuite) TestSnapshotWithIndexPath() {
}

func (gitSuite *gitTestSuite) TestSnapshotWithPathsFile() {
filesDir, err := ioutil.TempDir("", "")
filesDir, err := os.MkdirTemp("", "")
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module gitsnap

go 1.21
go 1.23.1

toolchain go1.22.2
toolchain go1.22.4

require (
github.com/avast/retry-go v3.0.0+incompatible
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/urfave/cli/v2"
)

const VERSION = "1.23"
const VERSION = "1.24"

func main() {
cli.AppHelpTemplate =
Expand Down

0 comments on commit 1f4a0aa

Please sign in to comment.