Skip to content

Commit

Permalink
fix: gofumpt
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Jan 2, 2024
1 parent 7d8fe81 commit db3dfe8
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
3 changes: 2 additions & 1 deletion controller/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package controller

import (
"fmt"
"github.com/gorilla/mux"
"net/http"
"regexp"
"time"

"github.com/gorilla/mux"
)

const (
Expand Down
7 changes: 4 additions & 3 deletions controller/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package controller

import (
"fmt"
"html/template"
"io/fs"
"net/http"

"github.com/caarlos0/httperr"
"github.com/caarlos0/starcharts/internal/cache"
"github.com/caarlos0/starcharts/internal/github"
"github.com/gorilla/mux"
"html/template"
"io/fs"
"net/http"
)

const (
Expand Down
3 changes: 2 additions & 1 deletion internal/chart/font.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package chart

import (
_ "embed"
"github.com/golang/freetype/truetype"
"sync"

"github.com/golang/freetype/truetype"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion internal/chart/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package chart

import (
"fmt"
"time"

"github.com/caarlos0/starcharts/internal/chart/svg"
"github.com/golang/freetype/truetype"
"golang.org/x/image/font"
"time"
)

func measureText(body string, size float64) Box {
Expand Down
4 changes: 2 additions & 2 deletions internal/chart/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func (c *Chart) Render(w io.Writer) {
}

func (c *Chart) getRanges(canvas *Box) (*Range, *Range) {
var minX, maxX = math.MaxFloat64, -math.MaxFloat64
var minY, maxY = math.MaxFloat64, -math.MaxFloat64
minX, maxX := math.MaxFloat64, -math.MaxFloat64
minY, maxY := math.MaxFloat64, -math.MaxFloat64

seriesLength := c.Series.Len()
for index := 0; index < seriesLength; index++ {
Expand Down
4 changes: 3 additions & 1 deletion internal/chart/series.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package chart

import (
"github.com/caarlos0/starcharts/internal/chart/svg"
"io"
"time"

"github.com/caarlos0/starcharts/internal/chart/svg"
)

type Series struct {
Expand All @@ -16,6 +17,7 @@ type Series struct {
func (ts *Series) Len() int {
return len(ts.XValues)
}

func (ts *Series) GetValues(index int) (x, y float64) {
x = toFloat64(ts.XValues[index])
y = ts.YValues[index]
Expand Down
5 changes: 3 additions & 2 deletions internal/chart/x_axis.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package chart

import (
"github.com/caarlos0/starcharts/internal/chart/svg"
"io"
"math"

"github.com/caarlos0/starcharts/internal/chart/svg"
)

type XAxis struct {
Expand All @@ -15,7 +16,7 @@ type XAxis struct {
func (xa *XAxis) Measure(canvas *Box, ra *Range, ticks []Tick) *Box {
var ltx, rtx int
var tx, ty int
var left, right, bottom = math.MaxInt32, 0, 0
left, right, bottom := math.MaxInt32, 0, 0
for _, t := range ticks {
v := t.Value
tb := measureText(t.Label, AxisFontSize)
Expand Down
3 changes: 2 additions & 1 deletion internal/chart/y_axis.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package chart

import (
"github.com/caarlos0/starcharts/internal/chart/svg"
"io"
"math"

"github.com/caarlos0/starcharts/internal/chart/svg"
)

type YAxis struct {
Expand Down

0 comments on commit db3dfe8

Please sign in to comment.