Skip to content

Commit 2451910

Browse files
committed
Add small functionality to helpers.GetTalks
It only returns the filenames right now, but it’s a start Signed-off-by: Matt Stratton <[email protected]>
1 parent 9ddf985 commit 2451910

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

helpers/get_talks.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
package helpers
22

3+
import (
4+
"fmt"
5+
"io/ioutil"
6+
"path/filepath"
7+
)
8+
39
// GetTalks takes in the city and year and returns a list of the talks
410
func GetTalks(city, year string) []string {
511

6-
s := make([]string, 3)
7-
s = append(s, "This is a talk", "So is this", "Rainbows are fun", "Never mind")
12+
talksDir := filepath.Join(EventContentPath(city, year), "program")
13+
14+
fmt.Println(talksDir)
15+
16+
// @TODO implement error checking in helpers.GetTalks
17+
files, _ := ioutil.ReadDir(talksDir)
18+
// if err != nil {
19+
// return nil, err
20+
// }
21+
22+
s := make([]string, len(files))
23+
for _, f := range files {
24+
s = append(s, f.Name())
25+
}
826
return s
927
}

0 commit comments

Comments
 (0)