Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linter warnings #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion s3imageserver/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/kr/s3"
)

//Image ...
type Image struct {
Path string
FileName string
Expand All @@ -34,6 +35,7 @@ type Image struct {
var allowedTypes = []string{".png", ".jpg", ".jpeg", ".gif", ".webp"}
var allowedMap = map[vips.ImageType]string{vips.WEBP: ".webp", vips.JPEG: ".jpg", vips.PNG: ".png"}

//NewImage ...
func NewImage(r *http.Request, config HandlerConfig, fileName string) (image *Image, err error) {
maxDimension := 3064
height := int(to.Float64(r.URL.Query().Get("h")))
Expand Down Expand Up @@ -94,7 +96,8 @@ func (i *Image) getImage(w http.ResponseWriter, r *http.Request, AWSAccess strin
err := i.getImageFromS3(AWSAccess, AWSSecret)
if err != nil {
fmt.Println(err)
err = i.getErrorImage()
errImage := i.getErrorImage()
fmt.Println(errImage)
w.WriteHeader(404)
} else {
i.resizeCrop()
Expand Down
4 changes: 4 additions & 0 deletions s3imageserver/s3imageserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/julienschmidt/httprouter"
)

//Config ...
type Config struct {
Handlers []HandlerConfig `json:"handlers"`
HTTPPort int `json:"http_port"`
Expand All @@ -26,6 +27,7 @@ type Config struct {
HTTPSKey string `json:"https_key"`
}

//HandlerConfig ...
type HandlerConfig struct {
Name string `json:"name"`
Prefix string `json:"prefix"`
Expand All @@ -42,8 +44,10 @@ type HandlerConfig struct {
CacheTime *int `json:"cache_time"`
}

//HandleVerification ...
type HandleVerification func(string) bool

//Run ...
func Run(verify HandleVerification) {
envArg := flag.String("c", "config.json", "Configuration")
flag.Parse()
Expand Down