Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rytswd/gocon2022-spring
https://github.com/rytswd/gocon2022-spring
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rytswd/gocon2022-spring
- Owner: rytswd
- Created: 2022-04-11T15:23:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-23T22:28:31.000Z (over 2 years ago)
- Last Synced: 2024-06-21T20:07:39.677Z (7 months ago)
- Language: Shell
- Size: 30.3 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Go Conference 2022 Spring
> Date: 23rd April, 2022
>
> Title: **Go Module with Microservices and Monorepo: Clear Dependencies with Ease of Development**
>
> Presented by [@rytswd](https://github.com/rytswd)Official Website: https://gocon.jp/2022spring/
Original Recording: https://youtu.be/jEdIXzvw_Ao
## π About This Repository
This repository contains all the materials used in my talk of "Go Module with Microservices and Monorepo: Clear Dependencies with Ease of Development" at Go Conference 2022 - Spring. There are mainly 3 demos, and it is made in a way that anyone can easily follow most of the steps on their own.
The details of each directory is as per below.
### Demo 1: Basics of Go Module
```
demos/1-basic
βββ demo.sh
βββ src
βββ go.mod
βββ go.sum
βββ main.go
```- `demo.sh`: A shell script made to run each command one by one when enter is pressed. You can follow the file content to run each line if you wish. The typing effect is achieved by [`/tools/demo-helper.sh`][5].
- `demo-src/`: The above `demo.sh` will create a new directory `demo-src` to start the demo from the empty directory.
- `src/`: This directory has all the files as the result of `demo.sh` run.
- `go.mod`: List of module paths used in this Go module.
- `go.sum`: List of direct and indirect dependencies, with cryptographic hashes for each.
- `main.go`: Simple "Hello World" example, which has dependency to https://github.com/Code-Hex/Neo-cowsay.### Demo 2: Details of `replace` Directive
```
demos/2-with-replace
βββ demo.sh
βββ src
βββ brazil-farm
β βββ coffee
β β βββ coffee.go
β βββ go.mod
βββ colombia-farm
β βββ coffee
β β βββ coffee.go
β βββ go.mod
βββ uk-farm
β βββ go.mod
β βββ milk
β βββ milk.go
βββ gocon-cafe
βββ go.mod
βββ main.go
```![Demo 2 Diagram](https://user-images.githubusercontent.com/23435099/164845319-fe2c40a8-808c-4eaf-9843-6900b3d27896.png)
- `demo.sh`: A shell script made to run each command one by one when enter is pressed. You can follow the file content to run each line if you wish. The typing effect is achieved by [`/tools/demo-helper.sh`][5].
- `demo-src/`: The above `demo.sh` will create a new directory `demo-src` to start the demo from the empty directory.
- `src/`: This directory has all the files as the result of `demo.sh` run.
- `brazil-farm/`: An example module, which defines a function `FruityCoffee()`.
- `colombia-farm/`: An example module, which defines a function `DarkRoastedCoffee()`.
- `uk-farm/`: An example module, which defines a function `WarmMilk()`.
- `gocon-cafe/main.go`: Uses dependencies and runs 2 functions:
- `MakeLatte()` - uses `FruityCoffee()` and `WarmMilk()`
- `MakeFlatWhite()` - uses `DarkRoastedCoffee()` and `WarmMilk()`### Demo 3: Putting All Things Together
```
demos/3-all-in-one
βββ demo.sh
βββ src
βββ brazil-farm
β βββ coffee
β β βββ coffee.go
β βββ go.mod
βββ colombia-farm
β βββ coffee
β β βββ coffee.go
β βββ go.mod
βββ uk-farm
β βββ go.mod
β βββ milk
β βββ milk.go
βββ gocon-cafe
β βββ go.mod
β βββ go.sum
β βββ main.go
βββ gocon-restaurant
βββ go.mod
βββ go.sum
βββ main.go
```![Demo 3 Diagram](https://user-images.githubusercontent.com/23435099/164851525-19bf8283-ce0b-4776-9541-84f4f8f50de0.png)
The directory structure is almost identical to `demos/2-with-replace`. The key differences are:
- `demo.sh` does not copy files, simply runs some commands directly against `src` directory (and other setup along the way)
- Each module (i.e. `brazil-farm`, `colombia-farm`, and `uk-farm`) have module path set to `go.rytswd/...`
- `gocon-cafe` uses module path reference based on Git commit, rather than `replace` directive
- `gocon-restaurant` is added first with module reference to the UK Farm commit of `5f50441`
- This allows `gocon-restaurant` to have its own dependency management[5]: https://github.com/rytswd/gocon2022-spring/blob/main/tools/demo-helper.sh
---
## π Slides
- [Slide used for presentation][4]
[4]: https://docs.google.com/presentation/d/17LZosr5Ex_SBiyO8EM7wtwNnaCM97q1ui7V6iGYrA-w/edit?usp=sharing
## π References
- [Go Modules Reference][1] - Official documentation
- [Life of a Go module][2] by Jay Conrod, former Go team member
- [Tutorial: Getting started with multi-module workspaces][3] - Official tutorial[1]: https://golang.org/ref/mod
[2]: https://jayconrod.com/posts/118/life-of-a-go-module
[3]: https://go.dev/doc/tutorial/workspaces## π« Special Thanks
The Go gopher was designed by RenΓ©e French. Illustrations by tottie.
Thanks to the Go Conference Committee for allowing me to present π₯°