Compare commits
No commits in common. "61de79b764f48f05b00f4f5ce5d7b3389179c79f" and "b77b45265887ef5308f547a511fb1f5a4839f5b9" have entirely different histories.
61de79b764
...
b77b452658
4
.gitignore
vendored
4
.gitignore
vendored
@ -37,7 +37,3 @@
|
|||||||
# Go workspace file
|
# Go workspace file
|
||||||
go.work
|
go.work
|
||||||
|
|
||||||
# MacOS
|
|
||||||
.DS_Store
|
|
||||||
|
|
||||||
bin/*
|
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Debug",
|
|
||||||
"type": "go",
|
|
||||||
"request": "launch",
|
|
||||||
"mode": "debug",
|
|
||||||
"program": "${workspaceRoot}",
|
|
||||||
"env": {},
|
|
||||||
"args": [],
|
|
||||||
"showLog": true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Build & Run",
|
|
||||||
"type": "go",
|
|
||||||
"request": "launch",
|
|
||||||
"mode": "exec",
|
|
||||||
"program": "${workspaceFolder}/bin/hello",
|
|
||||||
"console": "integratedTerminal",
|
|
||||||
"preLaunchTask": "go build",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
12
.vscode/tasks.json
vendored
12
.vscode/tasks.json
vendored
@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "go build",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "go build -o bin/hello ./...",
|
|
||||||
"group": "build",
|
|
||||||
"problemMatcher": ["$go"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
41
README.md
41
README.md
@ -30,18 +30,15 @@ package main
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
name := "World"
|
fmt.Println("Hello World!")
|
||||||
fmt.Println(getGreeting(name))
|
i := 101
|
||||||
}
|
fmt.Println(i)
|
||||||
|
|
||||||
func getGreeting(name string) string {
|
|
||||||
return fmt.Sprintf("Hello, %s!", name)
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Some useful hotkeys:
|
Some useful hotkeys:
|
||||||
- `Ctrl + Shift + D` - Open Debugger
|
- `Ctrl + Shift + D` - Open Debugger
|
||||||
- `F9` - set or toggle Breakpoint. *Try this line `name := "World"`*
|
- `F9` - set or toggle Breakpoint. *Try this line `i := 101`*
|
||||||
- `F5` - Start Debugging or to Run the Application. If asked to select environment: select `Go`
|
- `F5` - Start Debugging or to Run the Application. If asked to select environment: select `Go`
|
||||||
- `F10` - Step Over
|
- `F10` - Step Over
|
||||||
- `F11` - Step Into
|
- `F11` - Step Into
|
||||||
@ -60,36 +57,14 @@ Typical aka untouched `launch.json`:
|
|||||||
"type": "go",
|
"type": "go",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"mode": "debug",
|
"mode": "debug",
|
||||||
|
"remotePath": "",
|
||||||
|
"port": 2345,
|
||||||
|
"host": "127.0.0.1",
|
||||||
"program": "${workspaceRoot}",
|
"program": "${workspaceRoot}",
|
||||||
"env": {},
|
"env": {},
|
||||||
"args": [],
|
"args": [],
|
||||||
"showLog": true,
|
"showLog": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
# Custom build task
|
|
||||||
|
|
||||||
Create `tasks.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"label": "go build",
|
|
||||||
"type": "shell",
|
|
||||||
"command": "go build -o bin/tui ./...",
|
|
||||||
"group": "build",
|
|
||||||
"problemMatcher": ["$go"],
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Add this line to the desired run command in your `launch.json`
|
|
||||||
|
|
||||||
```json
|
|
||||||
"preLaunchTask": "go build",
|
|
||||||
```
|
|
||||||
|
9
go.mod
9
go.mod
@ -1,12 +1,3 @@
|
|||||||
module example/hello
|
module example/hello
|
||||||
|
|
||||||
go 1.22.2
|
go 1.22.2
|
||||||
|
|
||||||
require github.com/test-go/testify v1.1.4
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
|
||||||
github.com/stretchr/testify v1.10.0 // indirect
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
|
||||||
)
|
|
||||||
|
12
go.sum
12
go.sum
@ -1,12 +0,0 @@
|
|||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
|
||||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
|
||||||
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
|
|
||||||
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
9
hello.go
9
hello.go
@ -3,10 +3,7 @@ package main
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
name := "Worlds"
|
fmt.Println("Hello, World!")
|
||||||
fmt.Println(getGreeting(name))
|
i := 101
|
||||||
}
|
fmt.Println(i)
|
||||||
|
|
||||||
func getGreeting(name string) string {
|
|
||||||
return fmt.Sprintf("Hello, %s!", name)
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/test-go/testify/require"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Test_getGreeting(t *testing.T) {
|
|
||||||
t.Run("success", func(t *testing.T) {
|
|
||||||
require.Equal(t, "Hello, World!", getGreeting("World"))
|
|
||||||
})
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user