Skip to content

Commit f745545

Browse files
authored
reduce dependencies (#44)
1 parent 4803170 commit f745545

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ require (
88
github.com/go-resty/resty/v2 v2.7.0
99
github.com/mantyr/go-charset v0.0.0-20160510214718-44d054d82c4a
1010
github.com/stretchr/testify v1.7.0
11-
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d
1211
golang.org/x/text v0.3.7
1312
)
1413

@@ -28,6 +27,7 @@ require (
2827
github.com/pmezard/go-difflib v1.0.0 // indirect
2928
github.com/ugorji/go/codec v1.2.6 // indirect
3029
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
30+
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d // indirect
3131
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
3232
google.golang.org/protobuf v1.27.1 // indirect
3333
gopkg.in/yaml.v2 v2.4.0 // indirect

src/TibiaCharactersCharacterV3.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88

99
"github.com/PuerkitoBio/goquery"
1010
"github.com/gin-gonic/gin"
11-
"golang.org/x/net/html/atom"
1211
//"time"
1312
)
1413

@@ -120,6 +119,12 @@ type JSONData struct {
120119
Information Information `json:"information"`
121120
}
122121

122+
// From https://pkg.go.dev/golang.org/x/net/html/atom
123+
// This is an Atom. An Atom is an integer code for a string.
124+
// Instead of importing the whole lib, we thought it would be
125+
// best to just simply use the Br constant value.
126+
const Br = 0x202
127+
123128
func TibiaCharactersCharacterV3(c *gin.Context) {
124129
// getting params from URL
125130
character := c.Param("character")
@@ -256,7 +261,7 @@ func TibiaCharactersCharacterV3Impl(BoxContentHTML string) JSONData {
256261

257262
stringBuilder := strings.Builder{}
258263
for node != nil {
259-
if node.DataAtom == atom.Br {
264+
if node.DataAtom == Br {
260265
//It appears we can ignore br because either the encoding or goquery adds an \n for us
261266
//stringBuilder.WriteString("\n")
262267
} else {

0 commit comments

Comments
 (0)