Skip to content

Commit 15ff3ff

Browse files
authored
Run Gofumpt, add go.work (#3)
* gofumpt: Run on repo, tidy * add go.work file * Use latest danger-go version
1 parent 430f038 commit 15ff3ff

File tree

5 files changed

+16
-11
lines changed

5 files changed

+16
-11
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
run: npm install -g danger
2020

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

2424
- name: Check versions
2525
run: |

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Danger in Go
32

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

22-
import (
23-
"fmt"
24-
25-
"github.com/luno/danger-go"
26-
)
21+
import "github.com/luno/danger-go"
2722

2823
func Run(d *danger.T, pr danger.DSL) {
2924
d.Message("danger-go is running!", "", 0)

danger-js/danger-js.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import (
88
"strings"
99
)
1010

11-
const dangerJsBinary = "danger"
12-
const dangerGoBinary = "danger-go"
11+
const (
12+
dangerJsBinary = "danger"
13+
dangerGoBinary = "danger-go"
14+
)
1315

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

3840
var pr DSL
39-
if err = json.Unmarshal([]byte(prJSON), &pr); err != nil {
41+
if err = json.Unmarshal(prJSON, &pr); err != nil {
4042
return DSL{}, err
4143
}
4244
return pr, nil
@@ -52,7 +54,7 @@ func Process(command string, args []string) error {
5254
return err
5355
}
5456
// The `danger` (javascript) command will call the process specified,
55-
// ie. `danger-go`, with the first argument of `runner` followed by the
57+
// i.e. `danger-go`, with the first argument of `runner` followed by the
5658
// arguments it received.
5759
cmdArgs := append([]string{command, "--process", dangerGoBin, "--passURLForDSL"}, args...)
5860
cmd := exec.Command(dangerBin, cmdArgs...)

go.work

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
go 1.20
2+
3+
use (
4+
build/ci
5+
.
6+
)

go.work.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
2+
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=

0 commit comments

Comments
 (0)