We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c10e928 commit 7d78da6Copy full SHA for 7d78da6
main.go
@@ -7,6 +7,7 @@ import (
7
"log"
8
"math/rand"
9
"net/http"
10
+ "os"
11
"os/exec"
12
"runtime"
13
"time"
@@ -39,8 +40,10 @@ func openbrowser(url string) {
39
40
}
41
42
func main() {
43
+ arg := os.Args[1]
44
+
45
rand.Seed(time.Now().UnixNano())
- topStoriesUrl := "https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty"
46
+ topStoriesUrl := fmt.Sprintf("https://hacker-news.firebaseio.com/v0/%sstories.json?print=pretty", arg)
47
48
resp, err := http.Get(topStoriesUrl)
49
@@ -54,7 +57,7 @@ func main() {
54
57
if err != nil {
55
58
panic(err)
56
59
-
60
61
var topStories []int64
62
err = json.Unmarshal(body, &topStories)
63
0 commit comments