MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _make_hello_world

Function _make_hello_world

tests/languages/golang_test.py:57–93  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

55
56
57def _make_hello_world(tmp_path):
58 go_mod = '''\
59module golang-hello-world
60
61go 1.18
62
63require github.com/BurntSushi/toml v1.1.0
64'''
65 go_sum = '''\
66github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
67github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
68''' # noqa: E501
69 hello_world_go = '''\
70package main
71
72
73import (
74 "fmt"
75 "github.com/BurntSushi/toml"
76)
77
78type Config struct {
79 What string
80}
81
82func 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
96def test_golang_system(tmp_path):

Callers 3

test_golang_systemFunction · 0.70
test_during_commit_allFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected