Update CI script

This commit is contained in:
Trevor Slocum 2020-01-27 09:59:33 -08:00
parent 46712e512c
commit 7379d02282
3 changed files with 31 additions and 10 deletions

View file

@ -1,8 +1,26 @@
image: golang:latest
stages:
- test
- validate
fmt:
stage: validate
script:
- gofmt -l -s -e .
- exit $(gofmt -l -s -e . | wc -l)
lint:
stage: validate
script:
- go get -u golang.org/x/lint/golint
- golint -set_exit_status
vet:
stage: validate
script:
- go vet -composites=false ./...
test:
image: golang:latest
stage: test
stage: validate
script:
- go test -v ./...
- go test -race -v ./...

View file

@ -13,11 +13,12 @@ import (
// EntryType may be Application, Link or Directory.
type EntryType int
// All entry types
const (
Unknown EntryType = iota
Application
Link
Directory
Unknown EntryType = iota // Unspecified or unrecognized
Application // Execute command
Link // Open browser
Directory // Open file manager
)
func (t EntryType) String() string {

6
run.go
View file

@ -6,7 +6,9 @@ import (
"os"
)
func RunScript(ex string) (string, error) {
// RunScript creates a temporary run script consisting of a bash script which
// removes itself and executes the specified command.
func RunScript(exec string) (string, error) {
runScript, err := ioutil.TempFile("", "run-*")
if err != nil {
return "", err
@ -22,7 +24,7 @@ func RunScript(ex string) (string, error) {
runScript.Close()
return "", err
}
_, err = runScript.WriteString("exec " + ex + "\n")
_, err = runScript.WriteString("exec " + exec + "\n")
if err != nil {
runScript.Close()
return "", err