From 2d6094000156d5691d550b21b1b40fc9de1f2e3c Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Tue, 16 Sep 2025 10:52:43 -0400 Subject: [PATCH] Refactored jackpot handling and updated dependencies Replaced `currency.Amount` with `int` for jackpot values to simplify representation. Adjusted parsing logic accordingly. Updated Go version to 1.24.0 and refreshed dependencies in go.mod for compatibility. --- go.mod | 10 ++++++---- sites/powerball/powerball.go | 17 +++++++---------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 2c11dbb..3f0f183 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,14 @@ module gitea.stevedudenhoeffer.com/steve/go-extractor -go 1.23.2 +go 1.24.0 + +toolchain go1.24.1 require ( github.com/go-shiori/go-readability v0.0.0-20250217085726-9f5bf5ca7612 - github.com/playwright-community/playwright-go v0.5001.0 + github.com/playwright-community/playwright-go v0.5200.0 github.com/urfave/cli/v3 v3.0.0-beta1 - golang.org/x/text v0.23.0 + golang.org/x/text v0.29.0 ) require ( @@ -17,5 +19,5 @@ require ( github.com/go-shiori/dom v0.0.0-20230515143342-73569d674e1c // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect - golang.org/x/net v0.37.0 // indirect + golang.org/x/net v0.44.0 // indirect ) diff --git a/sites/powerball/powerball.go b/sites/powerball/powerball.go index 1fd047c..31589b1 100644 --- a/sites/powerball/powerball.go +++ b/sites/powerball/powerball.go @@ -9,8 +9,6 @@ import ( "time" "gitea.stevedudenhoeffer.com/steve/go-extractor" - - "golang.org/x/text/currency" ) type Config struct { @@ -30,8 +28,8 @@ type Drawing struct { } type NextDrawing struct { - Date string - Jackpot currency.Amount + Date string + JackpotDollars int } func deferClose(cl io.Closer) { @@ -165,16 +163,15 @@ func getNextDrawing(_ context.Context, doc extractor.Document) (*NextDrawing, er set := false if strings.Contains(txt, "Billion") { - amt := currency.USD.Amount(numeric * 1000000000) - nextDrawing.Jackpot = amt + amt := numeric * 1000000000 + nextDrawing.JackpotDollars = int(amt) set = true } else if strings.Contains(txt, "Million") { - amt := currency.USD.Amount(numeric * 1000000) - nextDrawing.Jackpot = amt + amt := numeric * 1000000 + nextDrawing.JackpotDollars = int(amt) set = true } else { - amt := currency.USD.Amount(numeric) - nextDrawing.Jackpot = amt + nextDrawing.JackpotDollars = int(numeric) set = true }