Skip to content

Commit d6f4413

Browse files
author
Dean Karn
authored
Updates & Additions (#9)
1 parent bc37f11 commit d6f4413

File tree

6 files changed

+81
-42
lines changed

6 files changed

+81
-42
lines changed

.github/workflows/go.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
name: Lint & Test
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
37
jobs:
48
test:
59
strategy:
610
matrix:
7-
go-version: [1.15.x,1.14.x,1.13.x]
8-
platform: [ubuntu-latest, macos-latest, windows-latest]
9-
runs-on: ${{ matrix.platform }}
11+
go-version: [1.17.x,1.16.x]
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
runs-on: ${{ matrix.os }}
1014
steps:
1115
- name: Install Go
12-
uses: actions/setup-go@v1
16+
uses: actions/setup-go@v2
1317
with:
1418
go-version: ${{ matrix.go-version }}
1519

16-
- name: Priming Cache
17-
uses: actions/cache@v1
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Restore Cache
24+
uses: actions/cache@v2
1825
with:
1926
path: ~/go/pkg/mod
2027
key: ${{ runner.os }}-v1-go-${{ hashFiles('**/go.sum') }}
@@ -24,12 +31,15 @@ jobs:
2431
- name: Checkout code
2532
uses: actions/checkout@v2
2633

27-
- name: Lint
28-
if: matrix.platform == 'ubuntu-latest' && matrix.go-version == '1.15.x'
29-
run: |
30-
export PATH=$PATH:$(go env GOPATH)/bin # temporary fix. See https://github.com/actions/setup-go/issues/14
31-
go get -u golang.org/x/lint/golint
32-
golint -set_exit_status ./...
33-
3434
- name: Test
35-
run: go test ./...
35+
run: go test ./...
36+
37+
golangci:
38+
name: lint
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: golangci-lint
43+
uses: golangci/golangci-lint-action@v2
44+
with:
45+
version: v1.43.0

bytes/size.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package bytesext
2+
3+
// Common byte unit sizes
4+
const (
5+
BYTE = 1
6+
7+
// Decimal (Powers of 10 for Humans)
8+
KB = 1000 * BYTE
9+
MB = 1000 * KB
10+
GB = 1000 * MB
11+
TB = 1000 * GB
12+
PB = 1000 * TB
13+
EB = 1000 * PB
14+
ZB = 1000 * EB
15+
YB = 1000 * ZB
16+
17+
// Binary (Powers of 2 for Computers)
18+
KiB = 1024 * BYTE
19+
MiB = 1024 * KiB
20+
GiB = 1024 * MiB
21+
TiB = 1024 * GiB
22+
PiB = 1024 * TiB
23+
EiB = 1024 * PiB
24+
ZiB = 1024 * EiB
25+
YiB = 1024 * ZiB
26+
)

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
module github.com/go-playground/pkg/v5
22

33
require (
4-
github.com/go-playground/assert v1.2.1 // indirect
54
github.com/go-playground/assert/v2 v2.0.1
6-
github.com/go-playground/form/v4 v4.1.1
5+
github.com/go-playground/form/v4 v4.2.0
76
)
87

9-
go 1.15
8+
go 1.17

go.sum

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
github.com/go-playground/assert v1.2.1 h1:ad06XqC+TOv0nJWnbULSlh3ehp5uLuQEojZY5Tq8RgI=
2-
github.com/go-playground/assert v1.2.1/go.mod h1:Lgy+k19nOB/wQG/fVSQ7rra5qYugmytMQqvQ2dgjWn8=
31
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
42
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
5-
github.com/go-playground/form/v4 v4.0.0 h1:vUKi2K1Hqlc4rpBc0tCclgs9zSfbY5yMKsL106db/eY=
6-
github.com/go-playground/form/v4 v4.0.0/go.mod h1:bodWfd97U9PVMZFcDsbVzSbQQTtaWrebnTwQtWjSW1M=
73
github.com/go-playground/form/v4 v4.1.1 h1:1T9lGt3WRHuDwT5uwx7RYQZfxVwWZhF0DC1ovKyNnWY=
84
github.com/go-playground/form/v4 v4.1.1/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=
5+
github.com/go-playground/form/v4 v4.2.0 h1:N1wh+Goz61e6w66vo8vJkQt+uwZSoLz50kZPJWR8eic=
6+
github.com/go-playground/form/v4 v4.2.0/go.mod h1:q1a2BY+AQUUzhl6xA/6hBetay6dEIhMHjgvJiGo6K7U=

io/limit_reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func LimitReader(r io.Reader, n int64) *LimitedReader {
2525
// that the limit was reached through the returned error.
2626
type LimitedReader struct {
2727
R io.Reader
28-
N int64 // bytes alloted
28+
N int64 // bytes allotted
2929
}
3030

3131
func (l *LimitedReader) Read(p []byte) (n int, err error) {

net/http/mime_types.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,29 @@ const (
66

77
// Mime Type values for the Content-Type HTTP header
88
const (
9-
ApplicationJSON string = "application/json" + charsetUTF8
10-
ApplicationJavaScript string = "application/javascript"
11-
ApplicationXML string = "application/xml" + charsetUTF8
12-
ApplicationForm string = "application/x-www-form-urlencoded"
13-
ApplicationProtobuf string = "application/protobuf"
14-
ApplicationMsgpack string = "application/msgpack"
15-
ApplicationWasm string = "application/wasm"
16-
ApplicationPDF string = "application/pdf"
17-
ApplicationOctetStream string = "application/octet-stream"
18-
TextHTML string = "text/html" + charsetUTF8
19-
TextPlain string = "text/plain" + charsetUTF8
20-
TextMarkdown string = "text/markdown" + charsetUTF8
21-
TextCSS string = "text/css" + charsetUTF8
22-
TextCSV string = "text/csv"
23-
ImagePNG string = "image/png"
24-
ImageGIF string = "image/gif"
25-
ImageSVG string = "image/svg+xml"
26-
ImageJPEG string = "image/jpeg"
27-
MultipartForm string = "multipart/form-data"
9+
ApplicationJSONNoCharset string = "application/json"
10+
ApplicationJSON string = ApplicationJSONNoCharset + charsetUTF8
11+
ApplicationJavaScript string = "application/javascript"
12+
ApplicationXMLNoCharset string = "application/xml"
13+
ApplicationXML string = ApplicationXMLNoCharset + charsetUTF8
14+
ApplicationForm string = "application/x-www-form-urlencoded"
15+
ApplicationProtobuf string = "application/protobuf"
16+
ApplicationMsgpack string = "application/msgpack"
17+
ApplicationWasm string = "application/wasm"
18+
ApplicationPDF string = "application/pdf"
19+
ApplicationOctetStream string = "application/octet-stream"
20+
TextHTMLNoCharset = "text/html"
21+
TextHTML string = TextHTMLNoCharset + charsetUTF8
22+
TextPlainNoCharset = "text/plain"
23+
TextPlain string = TextPlainNoCharset + charsetUTF8
24+
TextMarkdownNoCharset string = "text/markdown"
25+
TextMarkdown string = TextMarkdownNoCharset + charsetUTF8
26+
TextCSSNoCharset string = "text/css"
27+
TextCSS string = TextCSSNoCharset + charsetUTF8
28+
TextCSV string = "text/csv"
29+
ImagePNG string = "image/png"
30+
ImageGIF string = "image/gif"
31+
ImageSVG string = "image/svg+xml"
32+
ImageJPEG string = "image/jpeg"
33+
MultipartForm string = "multipart/form-data"
2834
)

0 commit comments

Comments
 (0)