Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.83 KB

Fix.md

File metadata and controls

32 lines (26 loc) · 1.83 KB

Fix Content [2019/09/07]:

Code

  • Adjust the project file directory, refer to hey project.
  • Change the Command help tips show method.

Fix Content [2019/06/22]:

Code

  • package name
  • Refactor one versions

girls.go:

  • Traditionally you would move your "main" to cmd/girls and not have your package as "main". This makes it impossible to use for anyone.
  • Typically you would name the file with "main()" main.go.

resize.go:

  • No need to export var Cmdline.
  • newFile, _ := os.Create(save) Check your errors!
  • resize.NearestNeighbor if you are doing a resize library, do some basic research. This is without a doubt the worst option you could have chosen. (use bicubic/lanczos)
  • jpeg.Encode(newFile, newImg, &jpeg.Options{85}) - wasn't there supposed to be a flag for quality?
  • defer newFile.Close() you might as well close it here, this is way too late. Move it to right after you've opened it.

task.go:

  • // GirImage.Resize used for various resource image type... This documentation says nothing.
  • type GirImage struct - this should just be "Image". No need to prefix your types here.
  • type GirTask struct.. again, could just as well be Task.
  • fin: make(chan bool) - this might as well be a chan struct{} since you are not using the bool anyway.
  • GirTask So the data []byte is the input file name or URL? Why is this a []byte. And why is it called "data" - I assumed it was the image data.
  • type GirImage struct. => Refactor Image interface
  • func (gt *GirTask) IsEmpty() bool. I personally prefer Empty() bool since the 'Is' is implied by the returned bool.
  • log.Println("resize fail:", err): Consider whether this should be written to stderr instead. Also your program returns status code 0 even if something failed, maybe not the best idea.