This talk I will show you the golang project layout and some best practice like as the following:
1. RESTful api and GraphQL
2. Model testing (Postgres, SQLite, MySQL)
3. Software Quality
4. Data Metrics
5. Go Testing
example MYSQL_PASSWORD: example MYSQL_DATABASE: example MYSQL_ROOT_PASSWORD: example minio: image: minio/minio restart: always ports: volumes: - minio-data:/data environment: MINIO_ACCESS_KEY: minio123456 MINIO_SECRET_KEY: minio123456 command: server /data Development
// BuildDate is the ISO 8601 day drone was built. BuildDate string ) // PrintCLIVersion print server info func PrintCLIVersion() string { return fmt.Sprintf( "version %s, built on %s, %s", Version, BuildDate, runtime.Version(), ) }
Color bool `envconfig:"GGZ_LOGS_COLOR"` Pretty bool `envconfig:"GGZ_LOGS_PRETTY"` Text bool `envconfig:"GGZ_LOGS_TEXT"` } // Server provides the server configuration. Server struct { Addr string `envconfig:"GGZ_SERVER_ADDR"` Port string `envconfig:"GGZ_SERVER_PORT" default:"12000"` Path string `envconfig:”GGZ_SERVER_PATH" default:"data"` } github.com/kelseyhightower/envconfig
string const ( // Internal error Internal Type = "internal" // NotFound error means that a specific item does not exis NotFound Type = "not_found" // BadRequest error BadRequest Type = "bad_request" // Validation error Validation Type = "validation" // AlreadyExists error AlreadyExists Type = "already_exists" // Unauthorized error Unauthorized Type = "unauthorized" )