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_r305005912
########## File path: pulsar-function-go/conf/conf.go ########## @@ -80,14 +80,34 @@ var ( confContent string ) +func fileExists(path string) bool { + if path == "" { + return false + } + _, err := os.Stat(path) + if err != nil && os.IsNotExist(err) { + return false + } + + return true +} + func (c *Conf) GetConf() *Conf { + var confFileExists = false flag.Parse() if help { flag.Usage() } - if confFilePath != "" { + confFileExists = fileExists(confFilePath) + + if (confContent == "" && (confFilePath == "" || !confFileExists){ Review comment: ```suggestion if (confContent == "" && (confFilePath == "" || !confFileExists) { ``` ---------------------------------------------------------------- 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