Skip to content

Commit

Permalink
Merge branch 'json-marshal-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterzen committed Jan 3, 2024
2 parents 43ecfc0 + cf5ffd9 commit 5c639a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions pwsmqttdispatcher/src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/xhhuango/json v1.19.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
)
2 changes: 2 additions & 0 deletions pwsmqttdispatcher/src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6r
github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/xhhuango/json v1.19.0 h1:6jXPGtpn0dHW7ecoQBIZmYZu1cRYYNm0qHUZdTkUhGA=
github.com/xhhuango/json v1.19.0/go.mod h1:ynZo8WeuBMtTh7LMR1ljdu/8QxceUVbYEcAsPJ7iUb8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down
9 changes: 5 additions & 4 deletions pwsmqttdispatcher/src/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package main

import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"log"
"math"
"net/http"
Expand All @@ -12,6 +11,8 @@ import (
"strings"
"time"

"github.com/xhhuango/json"

"github.com/PuerkitoBio/goquery"
mqtt "github.com/eclipse/paho.mqtt.golang"
)
Expand Down Expand Up @@ -57,7 +58,7 @@ func fetchDocumentFromPws() *goquery.Document {
}
defer resp.Body.Close()

htmlData, err := ioutil.ReadAll(resp.Body)
htmlData, err := io.ReadAll(resp.Body)
if err != nil {
log.Printf("Failed to fetch data from PWS: %s\n", err)
return nil
Expand All @@ -79,7 +80,7 @@ func fetchDocumentFromPws() *goquery.Document {
func parseFloat(s string) float64 {
f, err := strconv.ParseFloat(s, 64)
if err != nil {
return 0
return math.NaN()
}
return f
}
Expand Down

0 comments on commit 5c639a4

Please sign in to comment.