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:
Yong Tang 2017-09-24 15:32:45 +00:00
parent d2d42ee8b3
commit 0d1e4cf5b7
3 changed files with 4 additions and 2 deletions

View File

@ -28,8 +28,8 @@ import (
"os"
"path/filepath"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
tf "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/tensorflow/tensorflow/tensorflow/go/op"
)
func Example() {

View File

@ -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
limitations under the License.
*/
// Package internal generates Go source code with functions for TensorFlow operations.
package internal
// #cgo LDFLAGS: -ltensorflow

View File

@ -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())
}
} 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 {
return nil, err
}