Basic Start / Stop program
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
83bce6e16c
commit
34c883e250
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,4 +20,4 @@
|
||||
|
||||
# Go workspace file
|
||||
go.work
|
||||
|
||||
src/main
|
||||
|
3
src/go.mod
Normal file
3
src/go.mod
Normal file
@ -0,0 +1,3 @@
|
||||
module gitea.voser.cloud/Container/iwilldie/src
|
||||
|
||||
go 1.18
|
6
src/helper/func2test.go
Normal file
6
src/helper/func2test.go
Normal file
@ -0,0 +1,6 @@
|
||||
package helper
|
||||
|
||||
// Function to Test with go test
|
||||
func Func2test(num1, num2 int)(res int){
|
||||
return num1 + num2
|
||||
}
|
4
src/helper/func2test_10_vars.go
Normal file
4
src/helper/func2test_10_vars.go
Normal file
@ -0,0 +1,4 @@
|
||||
package helper
|
||||
|
||||
var num1 int = 2
|
||||
var num2 int = 16
|
1
src/helper/func2test_20_struct.go
Normal file
1
src/helper/func2test_20_struct.go
Normal file
@ -0,0 +1 @@
|
||||
package helper
|
13
src/helper/func2test_test.go
Normal file
13
src/helper/func2test_test.go
Normal file
@ -0,0 +1,13 @@
|
||||
package helper
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_Func2test(t *testing.T){
|
||||
|
||||
got := Func2test(2, 16)
|
||||
want := 18
|
||||
|
||||
if got != want {
|
||||
t.Errorf("got %q, wanted %q", got, want)
|
||||
}
|
||||
}
|
25
src/main.go
Normal file
25
src/main.go
Normal file
@ -0,0 +1,25 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitea.voser.cloud/Container/iwilldie/src/helper"
|
||||
)
|
||||
|
||||
func main() {
|
||||
start_server()
|
||||
result := helper.Func2test(2, 16)
|
||||
fmt.Printf("The result is %d \n", result)
|
||||
stop_server()
|
||||
}
|
||||
|
||||
// Start Server
|
||||
func start_server() {
|
||||
fmt.Println("Start Server now")
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Stop Server
|
||||
func stop_server() {
|
||||
fmt.Println("Stop Server now")
|
||||
}
|
1
src/main_test.go
Normal file
1
src/main_test.go
Normal file
@ -0,0 +1 @@
|
||||
package main
|
Loading…
Reference in New Issue
Block a user