(tmp_path)
| 55 | |
| 56 | |
| 57 | def _make_hello_world(tmp_path): |
| 58 | go_mod = '''\ |
| 59 | module golang-hello-world |
| 60 | |
| 61 | go 1.18 |
| 62 | |
| 63 | require github.com/BurntSushi/toml v1.1.0 |
| 64 | ''' |
| 65 | go_sum = '''\ |
| 66 | github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= |
| 67 | github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= |
| 68 | ''' # noqa: E501 |
| 69 | hello_world_go = '''\ |
| 70 | package main |
| 71 | |
| 72 | |
| 73 | import ( |
| 74 | "fmt" |
| 75 | "github.com/BurntSushi/toml" |
| 76 | ) |
| 77 | |
| 78 | type Config struct { |
| 79 | What string |
| 80 | } |
| 81 | |
| 82 | func main() { |
| 83 | var conf Config |
| 84 | toml.Decode("What = 'world'\\n", &conf) |
| 85 | fmt.Printf("hello %v\\n", conf.What) |
| 86 | } |
| 87 | ''' |
| 88 | tmp_path.joinpath('go.mod').write_text(go_mod) |
| 89 | tmp_path.joinpath('go.sum').write_text(go_sum) |
| 90 | mod_dir = tmp_path.joinpath('golang-hello-world') |
| 91 | mod_dir.mkdir() |
| 92 | main_file = mod_dir.joinpath('main.go') |
| 93 | main_file.write_text(hello_world_go) |
| 94 | |
| 95 | |
| 96 | def test_golang_system(tmp_path): |
no outgoing calls
no test coverage detected