Fix several issues with go fmt
and go lint
This fix fixes several issues related to `go fmt` and `go lint` based on https://goreportcard.com/report/github.com/tensorflow/tensorflow There are several changes: - `gofmt -s tensorflow/go/tensor.go` - `gofmt -s tensorflow/go/example_inception_inference_test.go` - `golint tensorflow/go/genop/internal/lib.go` At the moment there are still quite a few golint and ineffassign warnings in the current go code base. However, all of them are from `tensorflow/go/op/wrappers.go` which is machine generated code. This fix does not cover `tensorflow/go/op/wrappers.go`. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
d2d42ee8b3
commit
0d1e4cf5b7
@ -28,8 +28,8 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/tensorflow/tensorflow/tensorflow/go/op"
|
|
||||||
tf "github.com/tensorflow/tensorflow/tensorflow/go"
|
tf "github.com/tensorflow/tensorflow/tensorflow/go"
|
||||||
|
"github.com/tensorflow/tensorflow/tensorflow/go/op"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Example() {
|
func Example() {
|
||||||
|
@ -13,6 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Package internal generates Go source code with functions for TensorFlow operations.
|
||||||
package internal
|
package internal
|
||||||
|
|
||||||
// #cgo LDFLAGS: -ltensorflow
|
// #cgo LDFLAGS: -ltensorflow
|
||||||
|
@ -99,7 +99,7 @@ func NewTensor(value interface{}) (*Tensor, error) {
|
|||||||
return nil, bug("NewTensor incorrectly calculated the size of a tensor with type %v and shape %v as %v bytes instead of %v", dataType, shape, nbytes, buf.Len())
|
return nil, bug("NewTensor incorrectly calculated the size of a tensor with type %v and shape %v as %v bytes instead of %v", dataType, shape, nbytes, buf.Len())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
e := stringEncoder{offsets: buf, data: raw[nflattened*8 : len(raw)], status: newStatus()}
|
e := stringEncoder{offsets: buf, data: raw[nflattened*8:], status: newStatus()}
|
||||||
if err := e.encode(reflect.ValueOf(value)); err != nil {
|
if err := e.encode(reflect.ValueOf(value)); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user