mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-16 06:50:30 +02:00
Fix issues found by staticcheck
This commit is contained in:
@ -13,6 +13,7 @@ import (
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
@ -135,7 +136,7 @@ func main() {
|
||||
connChan := make(chan net.Conn)
|
||||
defer close(connChan)
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, os.Interrupt, os.Kill)
|
||||
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
"io/ioutil"
|
||||
"io/fs"
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
@ -28,10 +28,10 @@ type pyramidCreator struct {
|
||||
bg color.RGBA
|
||||
}
|
||||
|
||||
func findMaxDir(files []os.FileInfo) (min, max int) {
|
||||
func findMaxDir(files []os.DirEntry) (min, max int) {
|
||||
min, max = math.MaxInt32, math.MinInt32
|
||||
for _, file := range files {
|
||||
if !file.Mode().IsDir() {
|
||||
if !file.IsDir() {
|
||||
continue
|
||||
}
|
||||
if x, err := strconv.Atoi(file.Name()); err == nil {
|
||||
@ -46,10 +46,10 @@ func findMaxDir(files []os.FileInfo) (min, max int) {
|
||||
return
|
||||
}
|
||||
|
||||
func findMaxFile(files []os.FileInfo) (min, max int) {
|
||||
func findMaxFile(files []os.DirEntry) (min, max int) {
|
||||
min, max = math.MaxInt32, math.MinInt32
|
||||
for _, file := range files {
|
||||
if !file.Mode().IsRegular() {
|
||||
if !file.Type().IsRegular() {
|
||||
continue
|
||||
}
|
||||
name := file.Name()
|
||||
@ -86,8 +86,8 @@ func (pc *pyramidCreator) createParentLevel(
|
||||
return
|
||||
}
|
||||
|
||||
var files []os.FileInfo
|
||||
if files, err = ioutil.ReadDir(oldDir); err != nil {
|
||||
var files []fs.DirEntry
|
||||
if files, err = os.ReadDir(oldDir); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ func (pc *pyramidCreator) createParentLevel(
|
||||
ox1Dir := filepath.Join(oldDir, strconv.Itoa(ox))
|
||||
ox2Dir := filepath.Join(oldDir, strconv.Itoa(ox+1))
|
||||
|
||||
if files, err = ioutil.ReadDir(ox1Dir); err != nil {
|
||||
if files, err = os.ReadDir(ox1Dir); err != nil {
|
||||
return
|
||||
}
|
||||
zMin, zMax := findMaxFile(files)
|
||||
|
@ -22,8 +22,6 @@ import (
|
||||
"github.com/bamiaux/rez"
|
||||
"github.com/jackc/pgx/v4"
|
||||
|
||||
"bytes"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
)
|
||||
|
||||
@ -126,7 +124,7 @@ func (tu *tileUpdater) checkIP(r *http.Request) bool {
|
||||
}
|
||||
|
||||
for i := range tu.ips {
|
||||
if bytes.Compare(tu.ips[i], ip) == 0 {
|
||||
if tu.ips[i].Equal(ip) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user