Skip to content

Commit

Permalink
feat: reorganize main
Browse files Browse the repository at this point in the history
Signed-off-by: Manfred Touron <[email protected]>
  • Loading branch information
moul committed Jun 21, 2020
1 parent a48571e commit fd1aa2c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
5 changes: 5 additions & 0 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"fmt"
"log"
"os"

"moul.io/motd"
"moul.io/srand"
)

func main() {
Expand All @@ -13,7 +16,10 @@ func main() {
}
}

// nolint:unparam
func run(args []string) error {
fmt.Println("Hello World!")
srand.Fast()
fmt.Print(motd.Default())
fmt.Println("Hello World!", args)
return nil
}
10 changes: 7 additions & 3 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package main

func Example() {
run(nil)
// Output: Hello World!
import "testing"

func TestRun(t *testing.T) {
err := run(nil)
if err != nil {
t.Fatalf("err should be nil: %v", err)
}
}

0 comments on commit fd1aa2c

Please sign in to comment.