diff --git a/LICENSE b/LICENSE index 2071b23..b29b350 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) +Copyright (c) 2024 Drew Bednar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6e9967d --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +run: + go run ./cmd/bugbox/main.go +.PHONEY: run + +test: + go test -v ./... \ No newline at end of file diff --git a/README.md b/README.md index 9bd0cfb..29aeb58 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,18 @@ -# Go WTF Dial +# Bug Box -This was a series that strives to teach by building a real web application in go lang. Documented on https://www.gobeyond.dev/wtf-dial/ with source code available at https://github.com/benbjohnson/wtf?ref=gobeyond.dev +A RestAPI for managing bug enclosures. + +## Project Structure + +*Application domain* types reside in the project root and includes a a *Service* interface that serves as a contract for an underlying implementation. A *Service* implementation of the application domain is contained in the appropriate sub package (http, sqlite, etc.). The application is tied together in the `cmd` sub package. + +- Organization: +- User: +- Enclosure: + + + +## Inspiration + +The structure of this application follows the design patterns laid out in the [WTF-Dail](https://github.com/benbjohnson/wtf?ref=gobeyond.dev) which strives to be a reference implementation for a real golang web application. diff --git a/cmd/bugbox/main.go b/cmd/bugbox/main.go new file mode 100644 index 0000000..52841f2 --- /dev/null +++ b/cmd/bugbox/main.go @@ -0,0 +1,16 @@ +package main + +import ( + "fmt" + "io" + "os" +) + +func printMessage(w io.Writer, msg string) { + fmt.Fprint(w, msg) +} + +func main() { + + printMessage(os.Stdout, "Bugbox server\n") +} diff --git a/cmd/bugbox/main_test.go b/cmd/bugbox/main_test.go new file mode 100644 index 0000000..9af04a6 --- /dev/null +++ b/cmd/bugbox/main_test.go @@ -0,0 +1,18 @@ +package main + +import ( + "bytes" + "testing" +) + +func TestMain(t *testing.T) { + msg := "Bug box server\n" + buffer := bytes.Buffer{} + printMessage(&buffer, msg) + got := buffer.String() + want := msg + + if got != want { + t.Errorf("Error, got %s, want %s", got, want) + } +} diff --git a/enclosure.go b/enclosure.go new file mode 100644 index 0000000..5aa1923 --- /dev/null +++ b/enclosure.go @@ -0,0 +1 @@ +package bugbox diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..d031743 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module git.runcible.io/learning/bugbox + +go 1.23.1 diff --git a/organization.go b/organization.go new file mode 100644 index 0000000..5aa1923 --- /dev/null +++ b/organization.go @@ -0,0 +1 @@ +package bugbox diff --git a/user.go b/user.go new file mode 100644 index 0000000..5aa1923 --- /dev/null +++ b/user.go @@ -0,0 +1 @@ +package bugbox