Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyper authored and hyperjiang committed Nov 21, 2022
1 parent 2cbeda3 commit 0b9762a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 5 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package config

import (
"io/ioutil"
"log"
"os"

Expand Down Expand Up @@ -44,7 +43,7 @@ var (

// Load config from file
func Load(file string) (GlobalConfig, error) {
data, err := ioutil.ReadFile(file)
data, err := os.ReadFile(file)
if err != nil {
log.Printf("%v", err)
return Global, err
Expand All @@ -67,5 +66,8 @@ func init() {
if os.Getenv("config") != "" {
ConfigFile = os.Getenv("config")
}
Load(ConfigFile)

if _, err := Load(ConfigFile); err != nil {
log.Fatal("fail to load configs: " + err.Error())
}
}
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"log"
"path/filepath"

"github.com/gin-gonic/gin"
Expand All @@ -28,5 +29,7 @@ func main() {
router.Route(app)

// Listen and Serve
app.Run(*addr)
if err := app.Run(*addr); err != nil {
log.Fatal(err.Error())
}
}

0 comments on commit 0b9762a

Please sign in to comment.