Skip to content

Commit

Permalink
Run Gofumpt, add go.work (#3)
Browse files Browse the repository at this point in the history
* gofumpt: Run on repo, tidy

* add go.work file

* Use latest danger-go version
  • Loading branch information
echarrod authored Aug 23, 2023
1 parent 430f038 commit 15ff3ff
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: npm install -g danger

- name: Install danger-go
run: go install github.com/luno/danger-go/cmd/danger-go@v0.2.0 # match version used in build/ci
run: go install github.com/luno/danger-go/cmd/danger-go

- name: Check versions
run: |
Expand Down
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Danger in Go

This is a Go version of the popular [Danger](https://danger.systems/) tool.
Expand All @@ -19,11 +18,7 @@ Requires [Danger JS](https://danger.systems/js) to run properly.
```go
package main

import (
"fmt"

"github.com/luno/danger-go"
)
import "github.com/luno/danger-go"

func Run(d *danger.T, pr danger.DSL) {
d.Message("danger-go is running!", "", 0)
Expand Down
10 changes: 6 additions & 4 deletions danger-js/danger-js.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
"strings"
)

const dangerJsBinary = "danger"
const dangerGoBinary = "danger-go"
const (
dangerJsBinary = "danger"
dangerGoBinary = "danger-go"
)

func findBinary(name string) (string, error) {
cmd := exec.Command("which", name)
Expand All @@ -36,7 +38,7 @@ func GetPR(url string, dangerBin string) (DSL, error) {
}

var pr DSL
if err = json.Unmarshal([]byte(prJSON), &pr); err != nil {
if err = json.Unmarshal(prJSON, &pr); err != nil {
return DSL{}, err
}
return pr, nil
Expand All @@ -52,7 +54,7 @@ func Process(command string, args []string) error {
return err
}
// The `danger` (javascript) command will call the process specified,
// ie. `danger-go`, with the first argument of `runner` followed by the
// i.e. `danger-go`, with the first argument of `runner` followed by the
// arguments it received.
cmdArgs := append([]string{command, "--process", dangerGoBin, "--passURLForDSL"}, args...)
cmd := exec.Command(dangerBin, cmdArgs...)
Expand Down
6 changes: 6 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
go 1.20

use (
build/ci
.
)
2 changes: 2 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

0 comments on commit 15ff3ff

Please sign in to comment.