Add and fix ifshort
This commit is contained in:
parent
9390348a65
commit
796072a5a4
6 changed files with 5 additions and 11 deletions
|
@ -29,7 +29,6 @@ linters:
|
||||||
- testpackage
|
- testpackage
|
||||||
- stylecheck
|
- stylecheck
|
||||||
- wrapcheck
|
- wrapcheck
|
||||||
- ifshort
|
|
||||||
- gomnd
|
- gomnd
|
||||||
- goerr113
|
- goerr113
|
||||||
- errorlint
|
- errorlint
|
||||||
|
|
|
@ -52,8 +52,7 @@ func LoadConfig(path string) error {
|
||||||
viper.SetDefault("cli.insecure", false)
|
viper.SetDefault("cli.insecure", false)
|
||||||
viper.SetDefault("cli.timeout", "5s")
|
viper.SetDefault("cli.timeout", "5s")
|
||||||
|
|
||||||
err := viper.ReadInConfig()
|
if err := viper.ReadInConfig(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("Fatal error reading config file: %s \n", err)
|
return fmt.Errorf("Fatal error reading config file: %s \n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,7 @@ func main() {
|
||||||
NoColor: !colors,
|
NoColor: !colors,
|
||||||
})
|
})
|
||||||
|
|
||||||
err := cli.LoadConfig("")
|
if err := cli.LoadConfig(""); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Fatal().Err(err)
|
log.Fatal().Err(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
db.go
3
db.go
|
@ -105,8 +105,7 @@ func (h *Headscale) setValue(key string, value string) error {
|
||||||
Value: value,
|
Value: value,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := h.getValue(key)
|
if _, err := h.getValue(key); err == nil {
|
||||||
if err == nil {
|
|
||||||
h.db.Model(&kv).Where("key = ?", key).Update("value", value)
|
h.db.Model(&kv).Where("key = ?", key).Update("value", value)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -331,8 +331,7 @@ func (m *Machine) GetHostInfo() (*tailcfg.Hostinfo, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Headscale) isOutdated(m *Machine) bool {
|
func (h *Headscale) isOutdated(m *Machine) bool {
|
||||||
err := h.UpdateMachine(m)
|
if err := h.UpdateMachine(m); err != nil {
|
||||||
if err != nil {
|
|
||||||
// It does not seem meaningful to propagate this error as the end result
|
// It does not seem meaningful to propagate this error as the end result
|
||||||
// will have to be that the machine has to be considered outdated.
|
// will have to be that the machine has to be considered outdated.
|
||||||
return true
|
return true
|
||||||
|
|
3
oidc.go
3
oidc.go
|
@ -68,8 +68,7 @@ func (h *Headscale) RegisterOIDC(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
b := make([]byte, 16)
|
b := make([]byte, 16)
|
||||||
_, err := rand.Read(b)
|
if _, err := rand.Read(b); err != nil {
|
||||||
if err != nil {
|
|
||||||
log.Error().Msg("could not read 16 bytes from rand")
|
log.Error().Msg("could not read 16 bytes from rand")
|
||||||
c.String(http.StatusInternalServerError, "could not read 16 bytes from rand")
|
c.String(http.StatusInternalServerError, "could not read 16 bytes from rand")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue