Skip to content

Commit

Permalink
chore(golint): Cleaning up code and adding docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Tihomirov committed Jan 7, 2017
1 parent 8d21f7b commit 6a62774
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/gowo/cmd/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"github.com/whats-this/owo.go"
)

func DoUpload(cdn string, names []string) {
func doUpload(cdn string, names []string) {
files, err := owo.FilesToNamedReaders(names)
if err != nil {
log.Println("[upload]", err)
Expand Down Expand Up @@ -82,7 +82,7 @@ var uploadCmd = &cobra.Command{
log.Fatal("Need at least one file.")
}
cdn := viper.GetString("cdn")
DoUpload(cdn, args)
doUpload(cdn, args)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/gowo/cmd/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var watchCmd = &cobra.Command{
continue
}

go func() { DoUpload(cdn, names) }()
go doUpload(cdn, names)
}
}()

Expand Down
1 change: 1 addition & 0 deletions endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package owo
// APIRoot defines base url for the service's API endpoints
const APIRoot = "https://api.awau.moe"

// FileUploadLimit defines a set limit for pre-flight check before uploading files
const FileUploadLimit = 83886080

var (
Expand Down
3 changes: 3 additions & 0 deletions response.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
package owo

type (
// Response contains json marshalled response from owo
Response struct {
Success bool `json:"success"`
Errorcode int `json:"errorcode"`
Description string `json:"description"`
Files []File `json:"files"`
}

// File represents a single file from json response (if there were no errors)
File struct {
Hash string `json:"hash,omitempty"`
Name string `json:"name,omitempty"`
Expand All @@ -40,6 +42,7 @@ type (
}
)

// WithCDN returns file url prefixed with the CDN
func (f File) WithCDN(cdn string) string {
return cdn + f.URL
}

0 comments on commit 6a62774

Please sign in to comment.