Skip to content
This repository was archived by the owner on Jan 12, 2022. It is now read-only.

Commit 3808653

Browse files
committed
Add earthly as build system
This also adds linter and tests runner Signed-off-by: Ulysses Souza <[email protected]>
1 parent 586bb51 commit 3808653

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Pull Request
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code into the Go module directory
12+
uses: actions/checkout@v2
13+
14+
- name: Download latest earthly
15+
run: "sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/download/v0.5.23/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly'"
16+
17+
- name: Earthly version
18+
run: earthly --version
19+
20+
- name: Run linter
21+
run: earthly +lint
22+
23+
- name: Run tests
24+
run: earthly +test

Earthfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG GOLANG_VERSION=1.17.1
2+
ARG ALPINE_VERSION=3.14
3+
4+
FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION}
5+
WORKDIR /code
6+
7+
code:
8+
FROM +base
9+
COPY . .
10+
11+
golangci:
12+
ARG GOLANGCI_VERSION=v1.40.1
13+
FROM golangci/golangci-lint:${GOLANGCI_VERSION}-alpine
14+
SAVE ARTIFACT /usr/bin/golangci-lint
15+
16+
lint:
17+
FROM +code
18+
COPY +golangci/golangci-lint /usr/bin/golangci-lint
19+
RUN golangci-lint run --timeout 5m ./...
20+
21+
test:
22+
FROM +code
23+
RUN go test ./...
24+
25+
all:
26+
BUILD +lint
27+
BUILD +test

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ From the original Library:
1010
1111
This is a fork of [joho/godotenv](https://github.com/joho/godotenv) focussing on `.env` file support by the compose specification
1212

13+
14+
15+
To run linter and tests, please install [Earthly](https://earthly.dev/get-earthly) and run:
16+
```sh
17+
earthly +all
18+
```

godotenv.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -271,14 +271,6 @@ func parseLine(line string, envMap map[string]string) (key string, value string,
271271
err = errors.New("Can't separate key from value")
272272
return
273273
}
274-
275-
// Parse the key
276-
key = splitString[0]
277-
if strings.HasPrefix(key, "export") {
278-
key = strings.TrimPrefix(key, "export")
279-
}
280-
key = strings.TrimSpace(key)
281-
282274
key = exportRegex.ReplaceAllString(splitString[0], "$1")
283275

284276
// Parse the value

0 commit comments

Comments
 (0)