Skip to content

Commit

Permalink
Merge branch 'master' into deps-2402
Browse files Browse the repository at this point in the history
  • Loading branch information
vtopc authored Sep 16, 2024
2 parents 9533159 + a7b6ae6 commit 3d55258
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,35 @@ on:
pull_request:
branches: [ master, main ]
push:
branches: [master, main ]
branches: [ master, main ]

jobs:
test:
name: test
strategy:
matrix:
go-version:
- 1.18.x
- 1.19.x
- 1.20.x
- 1.22.x
- 1.23.x
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@master

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
cache: true # caching and restoring go modules and build outputs

- run: go env

- name: Cache deps
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install deps
run: go mod download

- name: nilaway
run: make nilaway

- name: Test
run: go test -v -race -p=1 -count=1
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
.PHONY: all
.DEFAULT_GOAL := all

PACKAGE := github.com/mailgun/mailgun-go
GOPATH=$(shell go env GOPATH)

NILAWAY = $(GOPATH)/bin/nilaway
$(NILAWAY):
go install go.uber.org/nilaway/cmd/nilaway@latest

.PHONY: all
all:
export GO111MODULE=on; go test . -v

.PHONY: godoc
godoc:
mkdir -p /tmp/tmpgoroot/doc
-rm -rf /tmp/tmpgopath/src/${PACKAGE}
mkdir -p /tmp/tmpgopath/src/${PACKAGE}
tar -c --exclude='.git' --exclude='tmp' . | tar -x -C /tmp/tmpgopath/src/${PACKAGE}
echo -e "open http://localhost:6060/pkg/${PACKAGE}\n"
GOROOT=/tmp/tmpgoroot/ GOPATH=/tmp/tmpgopath/ godoc -http=localhost:6060

# TODO(vtopc): fix mocks and enable nilaway for them too?
.PHONY: nilaway
nilaway: $(NILAWAY)
$(NILAWAY) -include-pkgs="$(PACKAGE)" -test=false -exclude-errors-in-files=mock_ ./...
3 changes: 3 additions & 0 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,9 @@ func (mg *MailgunImpl) GetStoredAttachment(ctx context.Context, url string) ([]b
r.addHeader("Accept", "message/rfc2822")

response, err := makeGetRequest(ctx, r)
if err != nil {
return nil, err
}

return response.Data, err
}

0 comments on commit 3d55258

Please sign in to comment.