Skip to content

Commit f8d4aad

Browse files
committed
chore: use Go 1.16 embed package
1 parent b3b7f5e commit f8d4aad

File tree

7 files changed

+18
-275
lines changed

7 files changed

+18
-275
lines changed

.github/workflows/pr.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install Go
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: 1.15
18+
go-version: 1.16
1919
- name: Checkout code
2020
uses: actions/checkout@v2
2121
- name: Check go mod
@@ -27,10 +27,15 @@ jobs:
2727
runs-on: ubuntu-latest
2828
steps:
2929
- uses: actions/checkout@v2
30+
- name: Install Go
31+
uses: actions/setup-go@v2
32+
with:
33+
go-version: 1.16
3034
- name: lint
3135
uses: golangci/golangci-lint-action@v2.3.0
3236
with:
3337
version: latest
38+
skip-go-installation: true
3439

3540
tests-on-windows:
3641
needs: golangci-lint # run after golangci-lint action to not produce duplicated errors
@@ -40,7 +45,7 @@ jobs:
4045
- name: Install Go
4146
uses: actions/setup-go@v2
4247
with:
43-
go-version: 1.15 # test only the latest go version to speed up CI
48+
go-version: 1.16 # test only the latest go version to speed up CI
4449
- name: Run tests
4550
run: go test ./...
4651
continue-on-error: true
@@ -52,7 +57,7 @@ jobs:
5257
- name: Install Go
5358
uses: actions/setup-go@v2
5459
with:
55-
go-version: 1.15 # test only the latest go version to speed up CI
60+
go-version: 1.16 # test only the latest go version to speed up CI
5661
- name: Run tests
5762
run: make test
5863
tests-on-unix:
@@ -61,7 +66,7 @@ jobs:
6166
strategy:
6267
matrix:
6368
golang:
64-
- 1.15
69+
- 1.16
6570
steps:
6671
- uses: actions/checkout@v2
6772
- name: Install Go
@@ -82,7 +87,7 @@ jobs:
8287
strategy:
8388
matrix:
8489
golang:
85-
- 1.15
90+
- 1.16
8691
steps:
8792
- uses: actions/checkout@v2
8893
- name: Install Go

generate.go

Lines changed: 0 additions & 3 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
module github.com/gotd/getdoc
22

3-
go 1.15
3+
go 1.16
44

55
require (
66
github.com/PuerkitoBio/goquery v1.6.1
77
github.com/cenkalti/backoff/v4 v4.1.0
8-
github.com/go-bindata/go-bindata v3.1.2+incompatible
98
github.com/kr/pretty v0.1.0 // indirect
109
github.com/stretchr/testify v1.6.1
1110
go.uber.org/atomic v1.7.0 // indirect

go.sum

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ github.com/andybalholm/cascadia v1.1.0 h1:BuuO6sSfQNFRu1LppgbD25Hr2vLYW25JvxHs5z
44
github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=
55
github.com/cenkalti/backoff/v4 v4.1.0 h1:c8LkOFQTzuO0WBM/ae5HdGQuZPfPxp7lqBRwQRm4fSc=
66
github.com/cenkalti/backoff/v4 v4.1.0/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
7-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
87
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
98
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
109
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
11-
github.com/go-bindata/go-bindata v3.1.2+incompatible h1:5vjJMVhowQdPzjE1LdxyFF7YFTXg5IgGVW4gBr5IbvE=
12-
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
1310
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
1411
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
1512
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@@ -29,18 +26,15 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
2926
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
3027
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
3128
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
32-
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 h1:CCH4IOTTfewWjGOlSp+zGcjutRKlBEZQ6wTn8ozI/nI=
3329
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
3430
golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI=
3531
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
3632
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3733
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3834
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
3935
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
40-
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
4136
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
4237
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
43-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
4438
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
4539
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
4640
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

internal/bindata.go

Lines changed: 0 additions & 246 deletions
This file was deleted.

load.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package getdoc
33
import (
44
"encoding/json"
55
"errors"
6-
"fmt"
7-
"path"
86

9-
"github.com/gotd/getdoc/internal"
7+
// For embedding parsed schema.
8+
_ "embed"
109
)
1110

1211
// Probably everything below should be code-generated from _schema folder.
@@ -32,17 +31,17 @@ func LayerExists(layer int) bool {
3231
// ErrNotFound means that current package version does not support requested layer.
3332
var ErrNotFound = errors.New("layer not found")
3433

34+
//go:embed _schema/121.json
35+
var schema121 []byte
36+
3537
// Load layer documentation.
3638
func Load(layer int) (*Doc, error) {
3739
if !LayerExists(layer) {
3840
return nil, ErrNotFound
3941
}
40-
data, err := internal.Asset(path.Join("_schema", fmt.Sprintf("%d.json", layer)))
41-
if err != nil {
42-
return nil, ErrNotFound
43-
}
42+
4443
var doc Doc
45-
if err := json.Unmarshal(data, &doc); err != nil {
44+
if err := json.Unmarshal(schema121, &doc); err != nil {
4645
return nil, err
4746
}
4847
return &doc, nil

tools.go

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)