Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Gofumpt, add go.work #3

Merged
merged 3 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=