From 2f1ac0463739d1ada3bbb02f80fecb77db5c621f Mon Sep 17 00:00:00 2001 From: nullawhale Date: Tue, 18 Apr 2023 16:09:33 +0300 Subject: [PATCH 1/5] Make only three common boards --- board.go | 127 ++++++++++++++++++++++++++++++++++++------------------- go.mod | 17 +++++--- go.sum | 75 ++++++++------------------------ main.go | 11 +++-- 4 files changed, 120 insertions(+), 110 deletions(-) diff --git a/board.go b/board.go index 8b84eab..3076c9c 100644 --- a/board.go +++ b/board.go @@ -6,27 +6,28 @@ import ( "github.com/manifoldco/promptui" "os" "strings" + "time" "unicode" "github.com/fatih/color" "github.com/lithammer/fuzzysearch/fuzzy" ) -type database struct { - Boards []*board `json:"boards"` +type Database struct { + Boards []*Board `json:"boards"` } -type board struct { - ID int64 `json:"id"` +type Board struct { Name string `json:"name"` Status bool `json:"status"` - Tasks []*task `json:"tasks"` + Tasks []*Task `json:"tasks"` } -type task struct { +type Task struct { ID int64 `json:"id"` Text string `json:"name"` Status bool `json:"status"` + Date string `json:"date"` } var green = color.New(color.FgGreen).SprintFunc() @@ -34,25 +35,31 @@ var purple = color.New(color.FgMagenta).SprintFunc() var gray = color.New(color.FgHiBlack).SprintFunc() var u = color.New(color.Underline).SprintFunc() +const ( + TaskActual string = "actual" + TaskMonth string = "month" + TaskRotten string = "rotten" +) + var indent = 10 -func NewDatabase() *database { - return &database{[]*board{}} +func NewDatabase() *Database { + return &Database{[]*Board{}} } -func ReadDatabaseFromFile(name string) (*database, error) { +func ReadDatabaseFromFile(name string) (*Database, error) { file, err := os.Open(name) if err != nil { return nil, err } defer file.Close() - var db database + var db Database err = json.NewDecoder(file).Decode(&db) return &db, err } -func (db *database) WriteToFile(name string) error { +func (db *Database) WriteToFile(name string) error { file, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE, 0600) if err != nil { return err @@ -62,9 +69,8 @@ func (db *database) WriteToFile(name string) error { return json.NewEncoder(file).Encode(db) } -func (db *database) addBoard(b *board) error { +func (db *Database) addBoard(b *Board) error { var err error - var maxID int64 = 0 if len(b.Name) >= 33 { return fmt.Errorf("board name must not be longer than 32 characters") @@ -79,21 +85,21 @@ func (db *database) addBoard(b *board) error { for _, board := range db.Boards { if board.Name == b.Name { - return fmt.Errorf("board with this name already exist") - } - if board.ID > maxID { - maxID = board.ID + return nil } } - b.ID = maxID + 1 db.Boards = append(db.Boards, b) return err } -func (db *database) NewTask(text string) error { - err := db.addTask(&task{Text: text}, "actual") +func (db *Database) NewTask(text string) error { + dateNow := time.Now() + err := db.addTask( + &Task{Text: text, Date: dateNow.Format(time.DateTime)}, + TaskActual, + ) if err != nil { return err } @@ -101,13 +107,16 @@ func (db *database) NewTask(text string) error { return err } -func (db *database) addTask(t *task, bName string) error { +func (db *Database) addTask(t *Task, bName string) error { var err error var maxID int64 = 0 - // TODO: maybe it should be default(system) Board with default(system) name + if bName == "" { + bName = TaskActual + } + if len(db.Boards) == 0 { - err := db.addBoard(&board{Name: bName, Status: false}) + err := db.addBoard(&Board{Name: bName, Status: false}) if err != nil { return err } @@ -117,7 +126,7 @@ func (db *database) addTask(t *task, bName string) error { if strings.ToLower(board.Name) == strings.ToLower(bName) { for _, task := range board.Tasks { if task.Text == t.Text { - fmt.Println("task already exists") + fmt.Println("Task already exists") return err } if task.ID > maxID { @@ -130,23 +139,12 @@ func (db *database) addTask(t *task, bName string) error { } } - // TODO: what if there's no Boards with given name: print error or add first one - /*for _, task := range db.Boards[0].Tasks { - if task.ID > maxID { - maxID = task.ID - } - } - t.ID = maxID + 1 - db.Boards[0].Tasks = append(db.Boards[0].Tasks, t) - err = db.writeToDB() - return err*/ - return err } -func (db *database) checkTask(taskPattern string) error { +func (db *Database) checkTask(taskPattern string) error { var err error - var matchedTasks []*task + var matchedTasks []*Task for _, board := range db.Boards { for _, task := range board.Tasks { @@ -166,11 +164,11 @@ func (db *database) checkTask(taskPattern string) error { var s []string var foundTaskString string for _, task := range matchedTasks { - //fmt.Printf("%s\n", task.Text) + //fmt.Printf("%s\n", Task.Text) s = append(s, task.Text) } prompt := promptui.Select{ - Label: "Found more than one task. Select one:", + Label: "Found more than one Task. Select one:", Items: s, } @@ -188,7 +186,7 @@ func (db *database) checkTask(taskPattern string) error { } } } - //fmt.Printf("task \"%s\" checked as done\n", matchedTask.Text) + //fmt.Printf("Task \"%s\" checked as done\n", matchedTask.Text) } else { return fmt.Errorf("task not found") } @@ -196,7 +194,7 @@ func (db *database) checkTask(taskPattern string) error { return err } -func (db *database) stat() string { +func (db *Database) stat() string { var done int64 = 0 var inProgress int64 = 0 var percent int64 = 0 @@ -223,7 +221,7 @@ func (db *database) stat() string { ) } -func (db *database) printDB(pattern string) { +func (db *Database) printDB(pattern string) { for _, board := range db.Boards { fmt.Printf("%s@%s\n", strings.Repeat(" ", indent/2), u(board.Name)) for _, task := range board.Tasks { @@ -234,9 +232,9 @@ func (db *database) printDB(pattern string) { strings.Repeat(" ", indent-len(id)), gray(id), green("[✓]"), gray(task.Text)) } else { - fmt.Printf("%s%s %s %s\n", + fmt.Printf("%s%s %s %s %s\n", strings.Repeat(" ", indent-len(id)), - gray(id), purple("[ ]"), task.Text) + gray(id), purple("[ ]"), task.Text, task.Date) } } } @@ -245,4 +243,45 @@ func (db *database) printDB(pattern string) { fmt.Print(db.stat()) } +func (db *Database) reCalcTasks() (*Database, error) { + var tmpDb = NewDatabase() + for _, board := range db.Boards { + //fmt.Println(board.Name) + for _, task := range board.Tasks { + taskDate, err := time.Parse(time.DateTime, task.Date) + if err != nil { + return nil, fmt.Errorf("wrong date format") + } + now := time.Now() + duration := now.Sub(taskDate) + hours := int(duration.Hours()) + + if hours < 24*7 { + // started no later than a week + err = tmpDb.addBoard(&Board{Name: TaskActual, Status: false}) + err = tmpDb.addTask(task, TaskActual) + if err != nil { + return nil, fmt.Errorf(err.Error()) + } + } else if hours > 24*7 && hours < 24*30 { + // started no later than a month + err = tmpDb.addBoard(&Board{Name: TaskMonth, Status: false}) + err = tmpDb.addTask(task, TaskMonth) + if err != nil { + return nil, fmt.Errorf(err.Error()) + } + } else if hours > 24*30 { + // started from month and later + err = tmpDb.addBoard(&Board{Name: TaskRotten, Status: false}) + err = tmpDb.addTask(task, TaskRotten) + if err != nil { + return nil, fmt.Errorf(err.Error()) + } + } + } + } + + return tmpDb, nil +} + // vi:noet:ts=4:sw=4: diff --git a/go.mod b/go.mod index 60f6104..dc3b4fd 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,18 @@ module github.com/nullawhale/ttrmg -go 1.16 +go 1.20 require ( - github.com/fatih/color v1.10.0 + github.com/fatih/color v1.15.0 github.com/jessevdk/go-flags v1.5.0 - github.com/lithammer/fuzzysearch v1.1.2 // indirect - github.com/manifoldco/promptui v0.8.0 // indirect - github.com/urfave/cli v1.22.5 + github.com/lithammer/fuzzysearch v1.1.5 + github.com/manifoldco/promptui v0.9.0 +) + +require ( + github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/text v0.3.7 // indirect ) diff --git a/go.sum b/go.sum index 6048f32..33a51ab 100644 --- a/go.sum +++ b/go.sum @@ -1,66 +1,27 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/c-bata/go-prompt v0.2.6 h1:POP+nrHE+DfLYx370bedwNhsqmpCUynWPxuHi0C5vZI= -github.com/c-bata/go-prompt v0.2.6/go.mod h1:/LMAke8wD2FsNu9EXNdHxNLbd9MedkPnCdfpU9wwHfY= +github.com/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/fatih/color v1.10.0 h1:s36xzo75JdqLaaWoiEHk767eHiwo0598uUxyfiPkDsg= -github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a h1:FaWFmfWdAUKbSCtOU2QjDaorUexogfaMgbipgYATUMU= -github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lithammer/fuzzysearch v1.1.2 h1:ePUtm14xKxbpCxozcFbIDRtvANxnVnE+RKpJUqkr2gA= -github.com/lithammer/fuzzysearch v1.1.2/go.mod h1:v6tYW/9kpfV6LNcweXdSjQsfCku/1M/oObmSox1fzP8= -github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a h1:weJVJJRzAJBFRlAiJQROKQs8oC9vOxvm4rZmBBk0ONw= -github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= -github.com/manifoldco/promptui v0.8.0 h1:R95mMF+McvXZQ7j1g8ucVZE1gLP3Sv6j9vlF9kyRqQo= -github.com/manifoldco/promptui v0.8.0/go.mod h1:n4zTdgP0vr0S3w7/O/g98U+e0gwLScEXGwov2nIKuGQ= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.6/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-tty v0.0.3 h1:5OfyWorkyO7xP52Mq7tB36ajHDG5OHrmBGIS/DtakQI= -github.com/mattn/go-tty v0.0.3/go.mod h1:ihxohKRERHTVzN+aSVRwACLCeqIoZAWpoICkkvrWyR0= -github.com/pkg/term v1.2.0-beta.2 h1:L3y/h2jkuBVFdWiJvNfYfKmzcCnILw7mJWm2JQuMppw= -github.com/pkg/term v1.2.0-beta.2/go.mod h1:E25nymQcrSllhX42Ok8MRm1+hyBdHY0dCeiKZ9jpNGw= -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/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU= -github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +github.com/lithammer/fuzzysearch v1.1.5 h1:Ag7aKU08wp0R9QCfF4GoGST9HbmAIeLP7xwMrOBEp1c= +github.com/lithammer/fuzzysearch v1.1.5/go.mod h1:1R1LRNk7yKid1BaQkmuLQaHruxcC4HmAH30Dh61Ih1Q= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/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-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200918174421-af09f7315aff/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4 h1:EZ2mChiOa8udjfp6rRmswTbtZN/QzUQp4ptM4rnjHvc= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +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= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/main.go b/main.go index 615f536..ecd3da8 100644 --- a/main.go +++ b/main.go @@ -2,10 +2,9 @@ package main import ( "fmt" + "github.com/jessevdk/go-flags" "os" "strings" - - "github.com/jessevdk/go-flags" ) type Options struct { @@ -38,6 +37,10 @@ func main() { panic(err) } } + db, err = db.reCalcTasks() + if err != nil { + fmt.Println(err.Error()) + } defer db.WriteToFile(options.DbPath) var command string @@ -50,14 +53,14 @@ func main() { } switch command { case "new": - err := db.NewTask(strings.Join(args, " ")) + err = db.NewTask(strings.Join(args, " ")) if err != nil { fmt.Println(err.Error()) } case "list": db.printDB(strings.Join(args, " ")) case "done": - err := db.checkTask(strings.Join(args, " ")) + err = db.checkTask(strings.Join(args, " ")) if err != nil { fmt.Println(err.Error()) } From 5662ff4a55d9c0f115166ae9cfb7044645481057 Mon Sep 17 00:00:00 2001 From: Nikita Date: Tue, 18 Apr 2023 16:13:35 +0300 Subject: [PATCH 2/5] Update go.yml --- .github/workflows/go.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6f6cfd5..92bd005 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -11,12 +11,12 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3.5.2 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v4.0.0 with: - go-version: 1.15 + go-version: 1.20 - name: Build run: go build -v ./... From a45af87b44303ad269fc12a9a3e2f30c3368195c Mon Sep 17 00:00:00 2001 From: nullawhale Date: Tue, 18 Apr 2023 16:22:36 +0300 Subject: [PATCH 3/5] update go.yaml --- .github/workflows/go.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 92bd005..db2bbc4 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,6 +18,10 @@ jobs: with: go-version: 1.20 + - name: Add $GOPATH/bin to PATH + run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + id: setup_path + - name: Build run: go build -v ./... From 63b2f653b3c79f60b2938bca0d279dabc5216d52 Mon Sep 17 00:00:00 2001 From: nullawhale Date: Tue, 18 Apr 2023 16:30:45 +0300 Subject: [PATCH 4/5] Update go.yml --- .github/workflows/go.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index db2bbc4..1caf36b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -18,9 +18,10 @@ jobs: with: go-version: 1.20 - - name: Add $GOPATH/bin to PATH - run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - id: setup_path + - name: Setup Go Environment + run: | + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Build run: go build -v ./... From cc93cd7622707d4fa511dd5bc37cb996a47c73b0 Mon Sep 17 00:00:00 2001 From: nullawhale Date: Tue, 18 Apr 2023 16:32:52 +0300 Subject: [PATCH 5/5] Update go.yml --- .github/workflows/go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 1caf36b..2455dbb 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -20,8 +20,8 @@ jobs: - name: Setup Go Environment run: | - echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV + echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Build run: go build -v ./...