Adding basic project structure

main
Drew Bednar 2 months ago
parent a1867a881d
commit 80e0429f09

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) <year> <copyright holders> 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: 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:

@ -0,0 +1,6 @@
run:
go run ./cmd/bugbox/main.go
.PHONEY: run
test:
go test -v ./...

@ -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.

@ -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")
}

@ -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)
}
}

@ -0,0 +1 @@
package bugbox

@ -0,0 +1,3 @@
module git.runcible.io/learning/bugbox
go 1.23.1

@ -0,0 +1 @@
package bugbox

@ -0,0 +1 @@
package bugbox
Loading…
Cancel
Save