Basic Start / Stop program
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Janic Voser 2023-03-10 23:25:08 +01:00
parent 83bce6e16c
commit 34c883e250
8 changed files with 54 additions and 1 deletions

2
.gitignore vendored
View File

@ -20,4 +20,4 @@
# Go workspace file # Go workspace file
go.work go.work
src/main

3
src/go.mod Normal file
View File

@ -0,0 +1,3 @@
module gitea.voser.cloud/Container/iwilldie/src
go 1.18

6
src/helper/func2test.go Normal file
View File

@ -0,0 +1,6 @@
package helper
// Function to Test with go test
func Func2test(num1, num2 int)(res int){
return num1 + num2
}

View File

@ -0,0 +1,4 @@
package helper
var num1 int = 2
var num2 int = 16

View File

@ -0,0 +1 @@
package helper

View 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
View 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
View File

@ -0,0 +1 @@
package main