refactor: modernize Go idioms across codebase
Replace map[string]interface{} with map[string]any, ioutil.ReadAll with
io.ReadAll, and simplify redundant fmt.Sprintf/w.Write calls.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8933055358
commit
439dc2cd07
7 changed files with 28 additions and 34 deletions
8
main.go
8
main.go
|
|
@ -5,7 +5,7 @@ import (
|
|||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -104,7 +104,7 @@ func main() {
|
|||
if configfile != nil && *configfile != "" {
|
||||
if fd, err := os.Open(*configfile); err != nil {
|
||||
log.Fatal(err)
|
||||
} else if cnt, err := ioutil.ReadAll(fd); err != nil {
|
||||
} else if cnt, err := io.ReadAll(fd); err != nil {
|
||||
log.Fatal(err)
|
||||
} else if err := json.Unmarshal(cnt, &myLDAP); err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
@ -137,7 +137,7 @@ func main() {
|
|||
if val, ok := os.LookupEnv("LDAP_SERVICE_PASSWORD_FILE"); ok {
|
||||
if fd, err := os.Open(val); err != nil {
|
||||
log.Fatal(err)
|
||||
} else if cnt, err := ioutil.ReadAll(fd); err != nil {
|
||||
} else if cnt, err := io.ReadAll(fd); err != nil {
|
||||
log.Fatal(err)
|
||||
} else {
|
||||
myLDAP.ServicePassword = string(cnt)
|
||||
|
|
@ -239,7 +239,7 @@ func main() {
|
|||
go func() {
|
||||
log.Fatal(srv.ListenAndServe())
|
||||
}()
|
||||
log.Println(fmt.Sprintf("Ready, listening on %s", *bind))
|
||||
log.Printf("Ready, listening on %s", *bind)
|
||||
|
||||
// Wait shutdown signal
|
||||
<-interrupt
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue