You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2019/05/23 14:58:09 UTC

[GitHub] [incubator-openwhisk-runtime-go] matthewrankin opened a new issue #89: Remove redundant Unmarshal in `gobuild.py.launcher.go`

matthewrankin opened a new issue #89: Remove redundant Unmarshal in `gobuild.py.launcher.go`
URL: https://github.com/apache/incubator-openwhisk-runtime-go/issues/89
 
 
   Below are lines 71–91 of [`common/gobuild.py.launcher.go`][1]. Line 83 appears to be redundant and unnecessary, as it is the same as line 73, which has already unmarshalled the data.
   
   https://github.com/apache/incubator-openwhisk-runtime-go/blob/1cbb96383502ca6df45058d966927c0796c31fbd/common/gobuild.py.launcher.go#L83
   
   https://github.com/apache/incubator-openwhisk-runtime-go/blob/1cbb96383502ca6df45058d966927c0796c31fbd/common/gobuild.py.launcher.go#L73
   
   
   ```go
   		// parse one line
   		var input map[string]interface{}
   		err = json.Unmarshal(inbuf, &input)  // Line 73
   		if err != nil {
   			log.Println(err.Error())
   			fmt.Fprintf(out, "{ error: %q}\n", err.Error())
   			continue
   		}
   		if debug {
   			log.Printf("%v\n", input)
   		}
   		// set environment variables
   		err = json.Unmarshal(inbuf, &input)  // Line 83: Appears to be redundant.
   		for k, v := range input {
   			if k == "value" {
   				continue
   			}
   			if s, ok := v.(string); ok {
   				os.Setenv("__OW_"+strings.ToUpper(k), s)
   			}
   		}
   ```
   
   [1]: https://github.com/apache/incubator-openwhisk-runtime-go/blob/master/common/gobuild.py.launcher.go

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services