Skip to content

Commit

Permalink
feat: add different example
Browse files Browse the repository at this point in the history
  • Loading branch information
youshy authored and addetz committed Aug 15, 2023
1 parent 49d9421 commit 7c282a5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions demo6/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"log"
"math/rand"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -104,12 +105,11 @@ func main() {
return userAuthService.AddUserNote(c)
})

// we're not checking an error here,
// so even our IDE is mad
str, _ := stringAndError()
names := []string{"John", "Steven", "Arthur", "Sebastien", "Joseph"}

// this error will never be checked
defer onlyError()
name := fmt.Sprintf("%s", names[rand.Intn(len(names))])

fmt.Printf("Hello, %s!", name)

log.Printf("Listening on :%s...\n", port)
if err := s.ListenAndServeTLS(certFile, keyFile); err != http.ErrServerClosed {
Expand Down Expand Up @@ -141,8 +141,7 @@ func connectDatabase() *sql.DB {
}
pwd, ok := os.LookupEnv("POSTGRES_PWD")
if !ok {
pwd = "THISISMYSUPERSECRETPASSWORD"
// log.Fatal("POSTGRES_PWD variable must be set")
log.Fatal("POSTGRES_PWD variable must be set")
}
db, ok := os.LookupEnv("POSTGRES_DB")
if !ok {
Expand Down

0 comments on commit 7c282a5

Please sign in to comment.