ravivooda / stocks

1 stars 0 forks source link

Forcefully assuming only holds 2 #66

Closed github-actions[bot] closed 1 year ago

github-actions[bot] commented 1 year ago

https://github.com/ravivooda/stocks/blob/4c049f2513ea9375832bf8a45b7a9f225043fad4/website/overlap.go#L38


    c.HTML(http.StatusOK, OverlapTemplate, data)
}

func (s *server) fetchOverlapParam(c *gin.Context) (string, []string) {
    param := c.Param(overlapParam)
    param = strings.ReplaceAll(param, ".html", "")
    holds := strings.SplitN(param, sep, 2)
    // TODO: Forcefully assuming only holds 2
    if len(holds) != 2 {
        panic(fmt.Sprintf("expected splittable by _ to 2 segments but did not find anyin %s", param))
    }
    return holds[0], []string{holds[1]}
}
github-actions[bot] commented 1 year ago

Closed in dec24de6fc0b919580a574dbfd5dc2375e53269f