Skip to content

k8s.io/klog/v2/klog logger types error #53

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
andresmijares opened this issue Mar 7, 2022 · 6 comments
Closed

k8s.io/klog/v2/klog logger types error #53

andresmijares opened this issue Mar 7, 2022 · 6 comments
Labels
question ❓ Further information is requested

Comments

@andresmijares
Copy link
Contributor

What is the question:

I'm having the following output trying to exec the readme.md sample

➜  engine git:(engine-sls-workflow) ✗ go version
go version go1.17.6 darwin/amd64
➜  engine git:(engine-sls-workflow) ✗ go run main.go
# k8s.io/klog/v2
../../../vendor/k8s.io/klog/v2/klog.go:703:10: invalid operation: logr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:722:10: invalid operation: logr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:740:10: invalid operation: logr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:761:10: invalid operation: logr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:780:11: invalid operation: loggr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:792:11: invalid operation: loggr != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:910:9: invalid operation: log != nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:1272:18: invalid operation: logging.logr == nil (mismatched types logr.Logger and nil)
../../../vendor/k8s.io/klog/v2/klog.go:1273:21: cannot use nil as type logr.Logger in field value
➜  engine git:(engine-sls-workflow) ✗

This is the code I'm trying to implement:

package main

import (
    "github.com/serverlessworkflow/sdk-go/v2/model"
    "github.com/serverlessworkflow/sdk-go/v2/parser"
)

func ParseWorkflow(filePath string) (*model.Workflow, error) {
    workflow, err := parser.FromFile(filePath)
    if err != nil {
        return nil, err
    } 
    return workflow, nil
} 

func main() {
      path := "./example/sample.json"
      w, err := ParseWorkflow(path)
      if err != nil {
            log.Fatal(err)
      }

      fmt.Print(w)
}

Any ideas?

@andresmijares andresmijares added the question ❓ Further information is requested label Mar 7, 2022
@ricardozanini
Copy link
Member

Sorry, @andresmijares. This one slipped from my inbox. I was on vacation, returning today. I'll take a look later this week.

@andresmijares
Copy link
Contributor Author

thank you!!

@ricardozanini
Copy link
Member

@andresmijares I know that's silly, but have you tried running on Go 1.14?

@andresmijares
Copy link
Contributor Author

andresmijares commented Apr 13, 2022

@ricardozanini i haven't! I will test it this weekend! ty for the suggestion

@bryanl
Copy link

bryanl commented Aug 13, 2022

For those finding this through a Google search, try updating your klog dependency. k8s.io/klog/v2 v2.70.1 works.

@ricardozanini
Copy link
Member

Thanks, @bryanl. I've opened an issue to track this down. I'll upgrade our dependencies.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question ❓ Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants