Project · Go Programming (backend and cloud)
Project: stock and GST bills for a kirana shop
The brief
Gupta Kirana Store wants a small Go program on its counter laptop. You build it step by step: rupee amounts in Indian format, the stock as a map of structs, a bill that refuses unknown items and short stock, CGST and SGST, a GST summary by rate, and a reorder list. Then you build one binary for the shop.
Why it matters
Billing and stock are the first software every Indian shop buys, and GST invoices must add up to the paisa. Keeping money in integer paise, modelling records as structs, looking items up in a map and sorting output for a stable report are exactly what junior backend developers do in their first months.
Skills you practise
- money in int64 paise
- Indian digit grouping with strings
- structs, maps of pointers and sorted keys
- functions returning (value, error)
- pointer and value receivers
- go build and go vet
You need
- Go 1.22 or newer installed from go.dev/dl
- A terminal and an editor with Go support (VS Code with the Go extension)
What you will have at the end
A Go module example.com/kirana and its built binary that prints the shop's stock, a GST bill (CGST + SGST) totalling Rs 1,030.70, a GST summary by rate and a reorder list.
How it is marked (rubric, 100 points)
| Correct billEvery amount matches to the paisa: lines, subtotal, CGST, SGST, total, the summary by rate and the stock left. | 40 |
|---|---|
| Data modelled wellMoney in int64 paise, items as structs in a map of pointers, a pointer receiver only where the bill changes. | 25 |
| Safe and stableUnknown items and short stock return errors instead of crashing; every list is printed in sorted order. | 20 |
| Professional finishgofmt and go vet clean, a built binary, clear names and short comments. | 15 |
0/7 steps done
Step 1 of 7
Start the module and format rupees
The module is example.com/kirana and formatRupees prints Rs 0.05, Rs 50.00, Rs 1,030.70 and Rs 1,23,456.78.
Make a folder kirana, run go mod init example.com/kirana, and copy main.go in. Indian bills group digits as lakhs and crores: the last three digits, then groups of two (1,23,456). Split paise into rupees (paise / 100) and paise (paise % 100), turn the rupees into text with strconv.Itoa, and insert the commas from the right. Print the paise with %02d so 5 paise shows as 05. The first line of the output is a self-check of four amounts.
$ cat go.mod; go run .Your notes: main.go
Write down each command you ran. It goes into your project summary.