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

DE-1328 Fix GetStoredAttachment and add nilaway #327

Merged
merged 7 commits into from
Sep 16, 2024
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
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
}
Loading