sijie commented on a change in pull request #4746: [go function] fix: go function should parse conf content first URL: https://github.com/apache/pulsar/pull/4746#discussion_r305307041
########## File path: pulsar-function-go/conf/conf.go ########## @@ -87,17 +87,23 @@ func (c *Conf) GetConf() *Conf { flag.Usage() } + if confContent == "" && confFilePath == "" { + log.Errorf("no yaml file or conf content provided") + return nil + } + if confFilePath != "" { yamlFile, err := ioutil.ReadFile(confFilePath) - if err != nil { + if err == nil { + err = yaml.Unmarshal(yamlFile, c) + if err != nil { + log.Errorf("unmarshal yaml file error:%s", err.Error()) + return nil + } + } else if (err != nil || os.IsNotExist(err)) && confContent == "" { Review comment: err != nil && !os.IsNotExist(err) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services