huaraz
(M Moeller)
December 23, 2024, 2:05pm
1
I get an undefined function error although the function exists in the code. How can I find the reason ? What methods can I use to troubleshoot this situation
I import:
"github.com/jcmturner/gokrb5/v8/client"
"github.com/jcmturner/gokrb5/v8/config"
"github.com/jcmturner/gokrb5/v8/credentials"
"github.com/jcmturner/gokrb5/v8/krberror"
"github.com/jcmturner/gokrb5/v8/spnego"
and can use successfully client.NewWithPassword but not client.NewClientFromCCache which are both defined in gokrb5/client/client.go at master · jcmturner/gokrb5 · GitHub
pekim
(Mike D Pilsbury)
December 23, 2024, 3:31pm
2
I’m not sure what’s causing your problem, but I can build a project that uses both of the functions that you mention.
go.mod
module temp
go 1.23.4
require github.com/jcmturner/gokrb5/v8 v8.4.4
require (
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
golang.org/x/crypto v0.6.0 // indirect
golang.org/x/net v0.7.0 // indirect
)
main.go
package main
import (
"fmt"
"github.com/jcmturner/gokrb5/v8/client"
"github.com/jcmturner/gokrb5/v8/config"
"github.com/jcmturner/gokrb5/v8/credentials"
)
func main() {
c1 := client.NewWithPassword("", "", "", &config.Config{})
fmt.Println(c1)
c2, err := client.NewFromCCache(&credentials.CCache{}, &config.Config{})
fmt.Println(err)
fmt.Println(c2)
}
$ go build main.go
$ ls -l
total 3096
-rw-r--r--. 1 mike mike 409 Dec 23 15:25 go.mod
-rw-r--r--. 1 mike mike 6203 Dec 23 15:25 go.sum
-rwxr-xr-x. 1 mike mike 3150575 Dec 23 15:30 main
-rw-r--r--. 1 mike mike 365 Dec 23 15:24 main.go
So it’s probably something silly. Perhaps a typo?
huaraz
(M Moeller)
December 24, 2024, 12:39am
3
Oh yes something silly. the function name changed i.e. it lost Client in the name.