updated dependencies and .drone.yml
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7dd768a2db
commit
8b3e22ba50
140
.drone.yml
140
.drone.yml
@ -1,89 +1,47 @@
|
|||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: cleanup-before
|
name: build-linux-amd64
|
||||||
|
|
||||||
steps:
|
environment:
|
||||||
- name: clean
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- rm -rf /build/*
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
path: /build
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
host:
|
|
||||||
path: /tmp/fuelprices/build
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default-linux-amd64
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: golang
|
|
||||||
commands:
|
|
||||||
- ./ci-build.sh build
|
|
||||||
environment:
|
|
||||||
GOOS: linux
|
GOOS: linux
|
||||||
GOARCH: amd64
|
GOARCH: amd64
|
||||||
volumes:
|
GOOPTIONS: -mod=vendor
|
||||||
- name: build
|
SRCFILES: cmd/fuelprices/*.go
|
||||||
path: /build
|
PROJECTNAME: fuelprices
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
host:
|
|
||||||
path: /tmp/fuelprices/build
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- cleanup-before
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default-linux-arm64
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
commands:
|
commands:
|
||||||
- ./ci-build.sh build
|
- go build -o $PROJECTNAME $GOOPTIONS $SRCFILES
|
||||||
environment:
|
when:
|
||||||
GOOS: linux
|
event:
|
||||||
GOARCH: arm64
|
exclude:
|
||||||
volumes:
|
- tag
|
||||||
- name: build
|
|
||||||
path: /build
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
host:
|
|
||||||
path: /tmp/fuelprices/build
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- cleanup-before
|
|
||||||
|
|
||||||
---
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: gitea-release
|
name: gitea-release-linux-amd64
|
||||||
|
|
||||||
|
environment:
|
||||||
|
GOOS: linux
|
||||||
|
GOARCH: amd64
|
||||||
|
GOOPTIONS: -mod=vendor
|
||||||
|
SRCFILES: cmd/fuelprices/*.go
|
||||||
|
PROJECTNAME: fuelprices
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: move
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- mv build/* ./
|
|
||||||
volumes:
|
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/src/build
|
image: golang
|
||||||
|
commands:
|
||||||
|
- go build -o $PROJECTNAME $GOOPTIONS $SRCFILES
|
||||||
|
- tar -czvf $PROJECTNAME-$DRONE_TAG-$GOOS-$GOARCH.tar.gz $PROJECTNAME
|
||||||
|
- echo $PROJECTNAME $DRONE_TAG > VERSION
|
||||||
when:
|
when:
|
||||||
event: tag
|
event:
|
||||||
|
- tag
|
||||||
- name: release
|
- name: release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
settings:
|
settings:
|
||||||
@ -95,50 +53,6 @@ steps:
|
|||||||
- sha256
|
- sha256
|
||||||
- sha512
|
- sha512
|
||||||
title: VERSION
|
title: VERSION
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
path: /drone/src/build
|
|
||||||
when:
|
when:
|
||||||
event: tag
|
event:
|
||||||
- name: ls
|
- tag
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- find .
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
path: /drone/src/build
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
host:
|
|
||||||
path: /tmp/fuelprices/build
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- default-linux-amd64
|
|
||||||
- default-linux-arm64
|
|
||||||
|
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: cleanup-after
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: clean
|
|
||||||
image: alpine
|
|
||||||
commands:
|
|
||||||
- rm -rf /build/*
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
path: /build
|
|
||||||
when:
|
|
||||||
event: tag
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: build
|
|
||||||
host:
|
|
||||||
path: /tmp/fuelprices/build
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- gitea-release
|
|
||||||
|
8
go.mod
8
go.mod
@ -3,12 +3,12 @@ module git.paulbsd.com/paulbsd/fuelprices
|
|||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/antchfx/xmlquery v1.3.8
|
github.com/antchfx/xmlquery v1.3.10
|
||||||
github.com/antchfx/xpath v1.2.0 // indirect
|
github.com/antchfx/xpath v1.2.0 // indirect
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
golang.org/x/net v0.0.0-20211203184738-4852103109b8 // indirect
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de // indirect
|
||||||
golang.org/x/text v0.3.7 // indirect
|
golang.org/x/text v0.3.7 // indirect
|
||||||
gopkg.in/ini.v1 v1.66.2
|
gopkg.in/ini.v1 v1.66.4
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
8
go.sum
8
go.sum
@ -1,5 +1,7 @@
|
|||||||
github.com/antchfx/xmlquery v1.3.8 h1:dRnBQM3Vk5BVJFvFwsHOLAox+mEiNw5ZusaUNCrEdoU=
|
github.com/antchfx/xmlquery v1.3.8 h1:dRnBQM3Vk5BVJFvFwsHOLAox+mEiNw5ZusaUNCrEdoU=
|
||||||
github.com/antchfx/xmlquery v1.3.8/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
github.com/antchfx/xmlquery v1.3.8/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
||||||
|
github.com/antchfx/xmlquery v1.3.10 h1:U2yMwr8U0KmGM2iDG2Ky/3LfxNsiK4uw1bSBkeMO9+g=
|
||||||
|
github.com/antchfx/xmlquery v1.3.10/go.mod h1:wojC/BxjEkjJt6dPiAqUzoXO5nIMWtxHS8PD8TmN4ks=
|
||||||
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
|
github.com/antchfx/xpath v1.2.0 h1:mbwv7co+x0RwgeGAOHdrKy89GvHaGvxxBtPK0uF9Zr8=
|
||||||
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
github.com/antchfx/xpath v1.2.0/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@ -10,6 +12,8 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l
|
|||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
|
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||||
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c h1:qSHzRbhzK8RdXOsAdfDgO49TtqC1oZ+acxPrkfTxcCs=
|
||||||
|
github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
@ -21,6 +25,8 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
|||||||
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||||
golang.org/x/net v0.0.0-20211203184738-4852103109b8 h1:PFkPt/jI9Del3hmFplBtRp8tDhSRpFu7CyRs7VmEC0M=
|
golang.org/x/net v0.0.0-20211203184738-4852103109b8 h1:PFkPt/jI9Del3hmFplBtRp8tDhSRpFu7CyRs7VmEC0M=
|
||||||
golang.org/x/net v0.0.0-20211203184738-4852103109b8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20211203184738-4852103109b8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de h1:pZB1TWnKi+o4bENlbzAgLrEbY4RMYmUIRobMcSmfeYc=
|
||||||
|
golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
@ -35,6 +41,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
|||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
|
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
|
||||||
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
|
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
|
||||||
|
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
122
vendor/github.com/antchfx/xmlquery/README.md
generated
vendored
122
vendor/github.com/antchfx/xmlquery/README.md
generated
vendored
@ -15,26 +15,13 @@ data or evaluate from XML documents with an XPath expression.
|
|||||||
XPATH query strings. Enabling caching can avoid recompile XPath expression for
|
XPATH query strings. Enabling caching can avoid recompile XPath expression for
|
||||||
each query.
|
each query.
|
||||||
|
|
||||||
Change Logs
|
You can visit this page to learn about the supported XPath(1.0/2.0) syntax. https://github.com/antchfx/xpath
|
||||||
===
|
|
||||||
|
|
||||||
2020-08-??
|
[htmlquery](https://github.com/antchfx/htmlquery) - Package for the HTML document query.
|
||||||
- Add XML stream loading and parsing support.
|
|
||||||
|
|
||||||
2019-11-11
|
[xmlquery](https://github.com/antchfx/xmlquery) - Package for the XML document query.
|
||||||
- Add XPath query caching.
|
|
||||||
|
|
||||||
2019-10-05
|
[jsonquery](https://github.com/antchfx/jsonquery) - Package for the JSON document query.
|
||||||
- Add new methods compatible with invalid XPath expression error: `QueryAll` and `Query`.
|
|
||||||
- Add `QuerySelector` and `QuerySelectorAll` methods, support for reused query objects.
|
|
||||||
- PR [#12](https://github.com/antchfx/xmlquery/pull/12) (Thanks @FrancescoIlario)
|
|
||||||
- PR [#11](https://github.com/antchfx/xmlquery/pull/11) (Thanks @gjvnq)
|
|
||||||
|
|
||||||
2018-12-23
|
|
||||||
- Added XML output including comment nodes. [#9](https://github.com/antchfx/xmlquery/issues/9)
|
|
||||||
|
|
||||||
2018-12-03
|
|
||||||
- Added support to attribute name with namespace prefix and XML output. [#6](https://github.com/antchfx/xmlquery/issues/6)
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
====
|
====
|
||||||
@ -42,6 +29,52 @@ Installation
|
|||||||
$ go get github.com/antchfx/xmlquery
|
$ go get github.com/antchfx/xmlquery
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
Quick Starts
|
||||||
|
===
|
||||||
|
|
||||||
|
```go
|
||||||
|
import (
|
||||||
|
"github.com/antchfx/xmlquery"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main(){
|
||||||
|
s := `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<rss version="2.0">
|
||||||
|
<channel>
|
||||||
|
<title>W3Schools Home Page</title>
|
||||||
|
<link>https://www.w3schools.com</link>
|
||||||
|
<description>Free web building tutorials</description>
|
||||||
|
<item>
|
||||||
|
<title>RSS Tutorial</title>
|
||||||
|
<link>https://www.w3schools.com/xml/xml_rss.asp</link>
|
||||||
|
<description>New RSS tutorial on W3Schools</description>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>XML Tutorial</title>
|
||||||
|
<link>https://www.w3schools.com/xml</link>
|
||||||
|
<description>New XML tutorial on W3Schools</description>
|
||||||
|
</item>
|
||||||
|
</channel>
|
||||||
|
</rss>`
|
||||||
|
|
||||||
|
doc, err := xmlquery.Parse(strings.NewReader(s))
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
channel := xmlquery.FindOne(doc, "//channel")
|
||||||
|
if n := channel.SelectElement("title"); n != nil {
|
||||||
|
fmt.Printf("title: %s\n", n.InnerText())
|
||||||
|
}
|
||||||
|
if n := channel.SelectElement("link"); n != nil {
|
||||||
|
fmt.Printf("link: %s\n", n.InnerText())
|
||||||
|
}
|
||||||
|
for i, n := range xmlquery.Find(doc, "//item/title") {
|
||||||
|
fmt.Printf("#%d %s\n", i, n.InnerText())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
===
|
===
|
||||||
|
|
||||||
@ -204,59 +237,6 @@ fmt.Println(doc.OutputXML(true))
|
|||||||
// <?xml version="1.0"?><rss><channel><title>W3Schools Home Page</title></channel></rss>
|
// <?xml version="1.0"?><rss><channel><title>W3Schools Home Page</title></channel></rss>
|
||||||
```
|
```
|
||||||
|
|
||||||
Quick Tutorial
|
Questions
|
||||||
===
|
|
||||||
|
|
||||||
```go
|
|
||||||
import (
|
|
||||||
"github.com/antchfx/xmlquery"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main(){
|
|
||||||
s := `<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<rss version="2.0">
|
|
||||||
<channel>
|
|
||||||
<title>W3Schools Home Page</title>
|
|
||||||
<link>https://www.w3schools.com</link>
|
|
||||||
<description>Free web building tutorials</description>
|
|
||||||
<item>
|
|
||||||
<title>RSS Tutorial</title>
|
|
||||||
<link>https://www.w3schools.com/xml/xml_rss.asp</link>
|
|
||||||
<description>New RSS tutorial on W3Schools</description>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<title>XML Tutorial</title>
|
|
||||||
<link>https://www.w3schools.com/xml</link>
|
|
||||||
<description>New XML tutorial on W3Schools</description>
|
|
||||||
</item>
|
|
||||||
</channel>
|
|
||||||
</rss>`
|
|
||||||
|
|
||||||
doc, err := xmlquery.Parse(strings.NewReader(s))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
channel := xmlquery.FindOne(doc, "//channel")
|
|
||||||
if n := channel.SelectElement("title"); n != nil {
|
|
||||||
fmt.Printf("title: %s\n", n.InnerText())
|
|
||||||
}
|
|
||||||
if n := channel.SelectElement("link"); n != nil {
|
|
||||||
fmt.Printf("link: %s\n", n.InnerText())
|
|
||||||
}
|
|
||||||
for i, n := range xmlquery.Find(doc, "//item/title") {
|
|
||||||
fmt.Printf("#%d %s\n", i, n.InnerText())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
List of supported XPath query packages
|
|
||||||
===
|
|
||||||
| Name | Description |
|
|
||||||
| ------------------------------------------------- | ----------------------------------------- |
|
|
||||||
| [htmlquery](https://github.com/antchfx/htmlquery) | XPath query package for HTML documents |
|
|
||||||
| [xmlquery](https://github.com/antchfx/xmlquery) | XPath query package for XML documents |
|
|
||||||
| [jsonquery](https://github.com/antchfx/jsonquery) | XPath query package for JSON documents |
|
|
||||||
|
|
||||||
Questions
|
|
||||||
===
|
===
|
||||||
Please let me know if you have any questions
|
Please let me know if you have any questions
|
||||||
|
7
vendor/github.com/antchfx/xmlquery/node.go
generated
vendored
7
vendor/github.com/antchfx/xmlquery/node.go
generated
vendored
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/xml"
|
"encoding/xml"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ func outputXML(buf *bytes.Buffer, n *Node, preserveSpaces bool) {
|
|||||||
preserveSpaces = calculatePreserveSpaces(n, preserveSpaces)
|
preserveSpaces = calculatePreserveSpaces(n, preserveSpaces)
|
||||||
switch n.Type {
|
switch n.Type {
|
||||||
case TextNode:
|
case TextNode:
|
||||||
xml.EscapeText(buf, []byte(n.sanitizedData(preserveSpaces)))
|
buf.WriteString(html.EscapeString(n.sanitizedData(preserveSpaces)))
|
||||||
return
|
return
|
||||||
case CharDataNode:
|
case CharDataNode:
|
||||||
buf.WriteString("<![CDATA[")
|
buf.WriteString("<![CDATA[")
|
||||||
@ -118,7 +119,7 @@ func outputXML(buf *bytes.Buffer, n *Node, preserveSpaces bool) {
|
|||||||
buf.WriteString(fmt.Sprintf(` %s=`, attr.Name.Local))
|
buf.WriteString(fmt.Sprintf(` %s=`, attr.Name.Local))
|
||||||
}
|
}
|
||||||
buf.WriteByte('"')
|
buf.WriteByte('"')
|
||||||
xml.EscapeText(buf, []byte(attr.Value))
|
buf.WriteString(html.EscapeString(attr.Value))
|
||||||
buf.WriteByte('"')
|
buf.WriteByte('"')
|
||||||
}
|
}
|
||||||
if n.Type == DeclarationNode {
|
if n.Type == DeclarationNode {
|
||||||
@ -142,7 +143,7 @@ func outputXML(buf *bytes.Buffer, n *Node, preserveSpaces bool) {
|
|||||||
func (n *Node) OutputXML(self bool) string {
|
func (n *Node) OutputXML(self bool) string {
|
||||||
preserveSpaces := calculatePreserveSpaces(n, false)
|
preserveSpaces := calculatePreserveSpaces(n, false)
|
||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
if self {
|
if self && n.Type != DocumentNode {
|
||||||
outputXML(&buf, n, preserveSpaces)
|
outputXML(&buf, n, preserveSpaces)
|
||||||
} else {
|
} else {
|
||||||
for n := n.FirstChild; n != nil; n = n.NextSibling {
|
for n := n.FirstChild; n != nil; n = n.NextSibling {
|
||||||
|
5
vendor/github.com/antchfx/xmlquery/parse.go
generated
vendored
5
vendor/github.com/antchfx/xmlquery/parse.go
generated
vendored
@ -246,6 +246,11 @@ func (p *parser) parse() (*Node, error) {
|
|||||||
AddSibling(p.prev, node)
|
AddSibling(p.prev, node)
|
||||||
} else if p.level > p.prev.level {
|
} else if p.level > p.prev.level {
|
||||||
AddChild(p.prev, node)
|
AddChild(p.prev, node)
|
||||||
|
} else if p.level < p.prev.level {
|
||||||
|
for i := p.prev.level - p.level; i > 1; i-- {
|
||||||
|
p.prev = p.prev.Parent
|
||||||
|
}
|
||||||
|
AddSibling(p.prev.Parent, node)
|
||||||
}
|
}
|
||||||
p.prev = node
|
p.prev = node
|
||||||
case xml.Directive:
|
case xml.Directive:
|
||||||
|
5
vendor/github.com/influxdata/influxdb1-client/v2/client.go
generated
vendored
5
vendor/github.com/influxdata/influxdb1-client/v2/client.go
generated
vendored
@ -556,7 +556,10 @@ func (c *client) Query(q Query) (*Response, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer resp.Body.Close()
|
defer func() {
|
||||||
|
io.Copy(ioutil.Discard, resp.Body) // https://github.com/influxdata/influxdb1-client/issues/58
|
||||||
|
resp.Body.Close()
|
||||||
|
}()
|
||||||
|
|
||||||
if err := checkResponse(resp); err != nil {
|
if err := checkResponse(resp); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
12
vendor/gopkg.in/ini.v1/.editorconfig
generated
vendored
Normal file
12
vendor/gopkg.in/ini.v1/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*_test.go]
|
||||||
|
trim_trailing_whitespace = false
|
1
vendor/gopkg.in/ini.v1/.gitignore
generated
vendored
1
vendor/gopkg.in/ini.v1/.gitignore
generated
vendored
@ -4,3 +4,4 @@ ini.sublime-workspace
|
|||||||
testdata/conf_reflect.ini
|
testdata/conf_reflect.ini
|
||||||
.idea
|
.idea
|
||||||
/.vscode
|
/.vscode
|
||||||
|
.DS_Store
|
||||||
|
23
vendor/gopkg.in/ini.v1/file.go
generated
vendored
23
vendor/gopkg.in/ini.v1/file.go
generated
vendored
@ -442,16 +442,16 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
kname = `"""` + kname + `"""`
|
kname = `"""` + kname + `"""`
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, val := range key.ValueWithShadows() {
|
writeKeyValue := func(val string) (bool, error) {
|
||||||
if _, err := buf.WriteString(kname); err != nil {
|
if _, err := buf.WriteString(kname); err != nil {
|
||||||
return nil, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if key.isBooleanType {
|
if key.isBooleanType {
|
||||||
if kname != sec.keyList[len(sec.keyList)-1] {
|
if kname != sec.keyList[len(sec.keyList)-1] {
|
||||||
buf.WriteString(LineBreak)
|
buf.WriteString(LineBreak)
|
||||||
}
|
}
|
||||||
continue KeyList
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write out alignment spaces before "=" sign
|
// Write out alignment spaces before "=" sign
|
||||||
@ -468,10 +468,27 @@ func (f *File) writeToBuffer(indent string) (*bytes.Buffer, error) {
|
|||||||
val = `"` + val + `"`
|
val = `"` + val + `"`
|
||||||
}
|
}
|
||||||
if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil {
|
if _, err := buf.WriteString(equalSign + val + LineBreak); err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
shadows := key.ValueWithShadows()
|
||||||
|
if len(shadows) == 0 {
|
||||||
|
if _, err := writeKeyValue(""); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, val := range shadows {
|
||||||
|
exitLoop, err := writeKeyValue(val)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else if exitLoop {
|
||||||
|
continue KeyList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, val := range key.nestedValues {
|
for _, val := range key.nestedValues {
|
||||||
if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil {
|
if _, err := buf.WriteString(indent + " " + val + LineBreak); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
19
vendor/gopkg.in/ini.v1/key.go
generated
vendored
19
vendor/gopkg.in/ini.v1/key.go
generated
vendored
@ -110,15 +110,24 @@ func (k *Key) Value() string {
|
|||||||
return k.value
|
return k.value
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValueWithShadows returns raw values of key and its shadows if any.
|
// ValueWithShadows returns raw values of key and its shadows if any. Shadow
|
||||||
|
// keys with empty values are ignored from the returned list.
|
||||||
func (k *Key) ValueWithShadows() []string {
|
func (k *Key) ValueWithShadows() []string {
|
||||||
if len(k.shadows) == 0 {
|
if len(k.shadows) == 0 {
|
||||||
|
if k.value == "" {
|
||||||
|
return []string{}
|
||||||
|
}
|
||||||
return []string{k.value}
|
return []string{k.value}
|
||||||
}
|
}
|
||||||
vals := make([]string, len(k.shadows)+1)
|
|
||||||
vals[0] = k.value
|
vals := make([]string, 0, len(k.shadows)+1)
|
||||||
for i := range k.shadows {
|
if k.value != "" {
|
||||||
vals[i+1] = k.shadows[i].value
|
vals = append(vals, k.value)
|
||||||
|
}
|
||||||
|
for _, s := range k.shadows {
|
||||||
|
if s.value != "" {
|
||||||
|
vals = append(vals, s.value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return vals
|
return vals
|
||||||
}
|
}
|
||||||
|
8
vendor/modules.txt
vendored
8
vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
|||||||
# github.com/antchfx/xmlquery v1.3.8
|
# github.com/antchfx/xmlquery v1.3.10
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
github.com/antchfx/xmlquery
|
github.com/antchfx/xmlquery
|
||||||
# github.com/antchfx/xpath v1.2.0
|
# github.com/antchfx/xpath v1.2.0
|
||||||
@ -9,14 +9,14 @@ github.com/antchfx/xpath
|
|||||||
# github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
|
# github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
|
||||||
## explicit
|
## explicit
|
||||||
github.com/golang/groupcache/lru
|
github.com/golang/groupcache/lru
|
||||||
# github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
|
# github.com/influxdata/influxdb1-client v0.0.0-20220302092344-a9ab5670611c
|
||||||
## explicit
|
## explicit
|
||||||
github.com/influxdata/influxdb1-client/models
|
github.com/influxdata/influxdb1-client/models
|
||||||
github.com/influxdata/influxdb1-client/pkg/escape
|
github.com/influxdata/influxdb1-client/pkg/escape
|
||||||
github.com/influxdata/influxdb1-client/v2
|
github.com/influxdata/influxdb1-client/v2
|
||||||
# github.com/stretchr/testify v1.7.0
|
# github.com/stretchr/testify v1.7.0
|
||||||
## explicit; go 1.13
|
## explicit; go 1.13
|
||||||
# golang.org/x/net v0.0.0-20211203184738-4852103109b8
|
# golang.org/x/net v0.0.0-20220325170049-de3da57026de
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
golang.org/x/net/html
|
golang.org/x/net/html
|
||||||
golang.org/x/net/html/atom
|
golang.org/x/net/html/atom
|
||||||
@ -40,7 +40,7 @@ golang.org/x/text/internal/utf8internal
|
|||||||
golang.org/x/text/language
|
golang.org/x/text/language
|
||||||
golang.org/x/text/runes
|
golang.org/x/text/runes
|
||||||
golang.org/x/text/transform
|
golang.org/x/text/transform
|
||||||
# gopkg.in/ini.v1 v1.66.2
|
# gopkg.in/ini.v1 v1.66.4
|
||||||
## explicit
|
## explicit
|
||||||
gopkg.in/ini.v1
|
gopkg.in/ini.v1
|
||||||
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
# gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
|
||||||
|
Loading…
Reference in New Issue
Block a user