VariableAmountOfArgs
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
module third
|
||||
|
||||
go 1.24.5
|
||||
|
||||
require github.com/headfirstgo/greeting v0.0.0-20190504033635-66e7507184ee // indirect
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
github.com/headfirstgo/greeting v0.0.0-20190504033635-66e7507184ee h1:Hb9bIxuBldEBCjyExf8LAWdR3V7ikknAHVGfAsP7pA0=
|
||||
github.com/headfirstgo/greeting v0.0.0-20190504033635-66e7507184ee/go.mod h1:VREJ5Jpvj59lYxvs0Uzt8BtzUg05tqSxp+H67JHSBn8=
|
||||
+23
-3
@@ -1,8 +1,28 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"third/sub"
|
||||
|
||||
"github.com/headfirstgo/greeting"
|
||||
)
|
||||
|
||||
func hi(input *string) string {
|
||||
if strings.TrimSpace(*input) == "kek" {
|
||||
return ""
|
||||
}
|
||||
*input = "func"
|
||||
return fmt.Sprintf("Hi from %s",*input)
|
||||
}
|
||||
|
||||
func main() {
|
||||
lol := 0.4444
|
||||
fmt.Printf("\nthis is float %#v\n",lol)
|
||||
input := "lol"
|
||||
fmt.Printf("Got from func: %s\n",hi(&input))
|
||||
fmt.Printf("Original one: %s\n\n\n\n",input)
|
||||
|
||||
sub.Hello()
|
||||
sub.Hi()
|
||||
|
||||
greeting.Hello()
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package sub
|
||||
|
||||
import "fmt"
|
||||
|
||||
func Hi() {
|
||||
fmt.Println("Hi from sub pkg")
|
||||
}
|
||||
|
||||
// Hello() just prints out another version of greeting
|
||||
func Hello() {
|
||||
fmt.Println("Hello from sub package!!")
|
||||
}
|
||||
Reference in New Issue
Block a user