Skip to content

Commit 8833481

Browse files
authored
Merge pull request #24 from gopherguides/better-errors
better errors and go 1.22
2 parents e097409 + 5d6c9da commit 8833481

File tree

232 files changed

+4568
-20711
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

232 files changed

+4568
-20711
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,29 @@ jobs:
66
runs-on: ${{ matrix.os }}
77
strategy:
88
matrix:
9-
go-version: [1.21.x]
9+
go-version: [1.22.x]
1010
os: [macos-latest, ubuntu-latest]
1111
steps:
12-
- uses: actions/checkout@v4
13-
- name: Set up Go
14-
uses: actions/setup-go@v4
15-
with:
16-
go-version: "1.21.x"
12+
- uses: actions/checkout@v4
13+
- name: Set up Go
14+
uses: actions/setup-go@v4
15+
with:
16+
go-version: "1.22.x"
1717

18-
- name: Go Environment
19-
run: go env
18+
- name: Go Environment
19+
run: go env
2020

21-
- name: Verify Go Modules
22-
run: go mod verify
21+
- name: Verify Go Modules
22+
run: go mod verify
2323

24-
- name: Build
25-
run: go build -v ./...
24+
- name: Build
25+
run: go build -v ./...
2626

27-
- name: Run tests with Race Detector
28-
run: go test -race -vet=off ./...
27+
- name: Run tests with Race Detector
28+
run: go test -race -vet=off ./...
2929

30-
- name: Install staticcheck
31-
run: go install honnef.co/go/tools/cmd/staticcheck@latest
32-
33-
- name: Run staticcheck
34-
run: staticcheck ./...
30+
- name: Install staticcheck
31+
run: go install honnef.co/go/tools/cmd/staticcheck@latest
3532

33+
- name: Run staticcheck
34+
run: staticcheck ./...

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ tmp
44
*.pid
55
coverage
66
coverage.data
7+
coverage.out
78
build/*
89
*.pbxuser
910
*.mode1v3

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ default: test install hype
33
test:
44
go test -timeout 10s -race -cover ./...
55

6+
cov:
7+
go test -coverprofile=coverage.out ./...
8+
go tool cover -html=coverage.out
9+
10+
hypecov:
11+
go test -coverprofile=coverage.out .
12+
go tool cover -html=coverage.out
13+
614
install:
715
go install -v ./cmd/hype
816

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module demo
22

3-
go 1.18
3+
go 1.22

body.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package hype
22

33
import (
44
"encoding/json"
5-
"fmt"
65
)
76

87
// Body is a container for all the elements in a document.
@@ -23,9 +22,9 @@ func (b *Body) MarshalJSON() ([]byte, error) {
2322
return nil, err
2423
}
2524

26-
m["type"] = fmt.Sprintf("%T", b)
25+
m["type"] = toType(b)
2726

28-
return json.Marshal(m)
27+
return json.MarshalIndent(m, "", " ")
2928
}
3029

3130
// AsPage returns the body as a Page.

0 commit comments

Comments
 (0)