pressly/screenshot-nodejs

Restructure the Golang client project repo

VojtechVitek opened this issue · 4 comments

screen shot 2017-12-12 at 4 53 26 pm

In golang, we usually put the client pkg into the top-level directory (unless the project is too big and has multiple clients, of course). Imho you can get rid of the lib/ subdirectory :)

If you wanted to implement CLI (a terminal program that downloads screenshots from a remote server), it'd live in /cmd/screenshot/main.go.

When the client pkg is in the top-level directory, the imports are as easy as

import (
     "github.com/pressly/screenshot"
)

func main() {
   screenshot, _ := screenshot.New(...)

   // ... 
}

In other words..
move screenshot/main.go to cmd/screenshot/main.go. Move lib/ into the top level directory.

Also, try to split PNG, PDF and JPEG into separate files (ie. client.go, png.go etc.).

@VojtechVitek I will close this when you approve of the restructure

LTGM! Well done