Browse Source

Update CI script

master
Trevor Slocum 2 years ago
parent
commit
7379d02282
  1. 26
      .gitlab-ci.yml
  2. 9
      entry.go
  3. 6
      run.go

26
.gitlab-ci.yml

@ -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 ./...

9
entry.go

@ -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

@ -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

Loading…
Cancel
Save