mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
go vet caught some nifty bugs. so fixed those here, and also made it so that we vet everything from now on since the robots seem to do a better job of vetting than we have managed to. also adds gofmt check to circle. could move this to the test.sh script (didn't want a script calling a script, because $reasons) and it's nice and isolated in its own little land as it is. side note, changed the script so it runs in 100ms instead of 3s, i think find is a lot faster than go list. attempted some minor cleanup of various scripts
28 lines
618 B
Go
28 lines
618 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
type Person struct {
|
|
Name string
|
|
}
|
|
|
|
func main() {
|
|
p := &Person{Name: "World"}
|
|
json.NewDecoder(os.Stdin).Decode(p)
|
|
mapD := map[string]string{"message": fmt.Sprintf("Hello %s", p.Name)}
|
|
mapB, _ := json.Marshal(mapD)
|
|
fmt.Println(string(mapB))
|
|
|
|
// TODO: move these lines to a test, this was for testing log output issues
|
|
log.Println("---> stderr goes to the server logs.")
|
|
log.Println("---> LINE 2")
|
|
log.Println("---> LINE 3 with a break right here\nand LINE 4")
|
|
log.Printf("---> LINE 5 with a double line break\n\n")
|
|
log.Println("---> LINE 6")
|
|
}
|