Upgrade to Go 1.19
This commit is contained in:
parent
2d06e8e09c
commit
741f18efd1
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
build
|
||||
.idea
|
@ -43,6 +43,7 @@ By default, the config file is searched for in `[HOME_DIR]./config/grm/config.ya
|
||||
|
||||
## Changelog
|
||||
|
||||
- 0.3.1 Upgrade to Go 1.19
|
||||
- 0.3.0 Adding the ability to limit actions to repositories containing a given name or tags
|
||||
- 0.2.0 Add status command - get information about the current status in the repository
|
||||
- 0.1.1 Allow to use env vars in config
|
||||
|
@ -1,8 +1,5 @@
|
||||
version: '3'
|
||||
|
||||
env:
|
||||
go_dir:
|
||||
|
||||
tasks:
|
||||
pull:
|
||||
cmds:
|
||||
@ -10,10 +7,7 @@ tasks:
|
||||
silent: true
|
||||
test:
|
||||
cmds:
|
||||
- go test ./app
|
||||
- go test ./commands
|
||||
- go test ./config
|
||||
- go test ./echo
|
||||
- go test $(find . -name "*.go" -exec dirname {} \; | uniq | grep '/') -cover
|
||||
build:
|
||||
cmds:
|
||||
- mkdir -p build
|
||||
|
10
app/app.go
10
app/app.go
@ -12,8 +12,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
APP_NAME = "Git repository manager"
|
||||
APP_DESCRIPTION = "Manage your repository with simple app"
|
||||
AppName = "Git repository manager"
|
||||
AppDescription = "Manage your repository with simple app"
|
||||
VERSION = "0.3.0"
|
||||
errNotFoundTags = "no repository was found with the specified tags"
|
||||
errNotFoundName = "no repository was found with the specified name"
|
||||
@ -25,7 +25,7 @@ type GitRepositoryManager struct {
|
||||
}
|
||||
|
||||
func (g *GitRepositoryManager) Parse(args []string) error {
|
||||
arguments, err := config.ParseCliArguments(APP_NAME, APP_DESCRIPTION, args)
|
||||
arguments, err := config.ParseCliArguments(AppName, AppDescription, args)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v", err.Error())
|
||||
return err
|
||||
@ -37,13 +37,13 @@ func (g *GitRepositoryManager) Parse(args []string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
fileExcension, err := getFileExcension(arguments.ConfigurationFile)
|
||||
fileExtension, err := getFileExtension(arguments.ConfigurationFile)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v", err.Error())
|
||||
return err
|
||||
}
|
||||
|
||||
configuration, err := config.GetRepositoryConfig(configFileContent, fileExcension)
|
||||
configuration, err := config.GetRepositoryConfig(configFileContent, fileExtension)
|
||||
if err != nil {
|
||||
fmt.Printf("Error: %v", err.Error())
|
||||
return err
|
||||
|
16
app/utils.go
16
app/utils.go
@ -3,27 +3,27 @@ package app
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"gitlab.com/revalus/grm/config"
|
||||
)
|
||||
|
||||
func getFileContent(pathToFile string) ([]byte, error) {
|
||||
return ioutil.ReadFile(pathToFile)
|
||||
return os.ReadFile(pathToFile)
|
||||
}
|
||||
|
||||
func getFileExcension(pathToFile string) (string, error) {
|
||||
splittedFileName := strings.Split(pathToFile, ".")
|
||||
func getFileExtension(pathToFile string) (string, error) {
|
||||
splitFileName := strings.Split(pathToFile, ".")
|
||||
|
||||
if len(splittedFileName) == 1 {
|
||||
msg := fmt.Sprintf("excension for file \"%v\", not found", splittedFileName)
|
||||
if len(splitFileName) == 1 {
|
||||
msg := fmt.Sprintf("excension for file \"%v\", not found", splitFileName)
|
||||
return "", errors.New(msg)
|
||||
}
|
||||
|
||||
fileExcension := splittedFileName[len(splittedFileName)-1]
|
||||
fileExtension := splitFileName[len(splitFileName)-1]
|
||||
|
||||
return fileExcension, nil
|
||||
return fileExtension, nil
|
||||
}
|
||||
|
||||
func checkIsItemInSlice(check string, sliceToCheck []string) bool {
|
||||
|
@ -16,7 +16,7 @@ func TestGetFileExtension(t *testing.T) {
|
||||
}
|
||||
|
||||
for key, value := range toTest {
|
||||
result, err := getFileExcension(key)
|
||||
result, err := getFileExtension(key)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error: %v", err)
|
||||
@ -32,7 +32,7 @@ func TestGetFileExtension(t *testing.T) {
|
||||
|
||||
func TestErrorInGetExcensionFile(t *testing.T) {
|
||||
|
||||
result, err := getFileExcension("test")
|
||||
result, err := getFileExtension("test")
|
||||
|
||||
if err == nil {
|
||||
t.Errorf("Expected to get error, instead of this got result %v", result)
|
||||
|
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
||||
module gitlab.com/revalus/grm
|
||||
|
||||
go 1.17
|
||||
go 1.19
|
||||
|
||||
require (
|
||||
github.com/akamensky/argparse v1.3.1
|
||||
|
2
go.sum
2
go.sum
@ -94,7 +94,6 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/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-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@ -104,7 +103,6 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
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=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
Loading…
Reference in New Issue
Block a user