Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix golint & gofmt #235

Merged
merged 1 commit into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/entity/metrics_pod.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package entity

// NICMetrics is the structure for NIC metrics
// NICShortMetrics is the structure for NIC metrics
type NICShortMetrics struct {
NICNetworkTraffic NICNetworkTrafficMetrics `json:"nicNetworkTraffic"`
}
Expand Down
8 changes: 4 additions & 4 deletions src/entity/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import (
)

const (
// PodCollectionName's const
// PodCollectionName is a const string
PodCollectionName string = "pods"
// The network type for the Pod
// PodHostNetwork is the network type for the Pod
// host means the pod use the hostNetwork (share the network with the host machine)
PodHostNetwork = "host"
// cluster means use the cluster Network, maybe the flannel network
// PodClusterNetwork is cluster which means use the cluster Network, maybe the flannel network
PodClusterNetwork = "cluster"
// custom means the custom netwokr we created before, it support the OVS and DPDK network for additional network interface card
// PodCustomNetwork is custom which means the custom netwokr we created before, it support the OVS and DPDK network for additional network interface card
PodCustomNetwork = "custom"
)

Expand Down
2 changes: 0 additions & 2 deletions src/kubernetes/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import (
"k8s.io/client-go/kubernetes"
)


// KubeCtl object is used to interact with the kubernetes cluster.
// Use the export function New to Get a KubeCtl object.
type KubeCtl struct {
Clientset kubernetes.Interface
}


// New is the API to New a kubectl object and you need to pass two parameters
// 1. The kubernetes clientset object from the client-go library. You can also use the fake-client for testing
// 2. The namespace of the kubernetes you want to manipulate
Expand Down
5 changes: 5 additions & 0 deletions src/net/http/query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@ import (
"strconv"
)

// QueryUrl is the structure
type QueryUrl struct {
Url url.Values `json:"url"`
}

// New will new a QueryUrl
func New(url url.Values) *QueryUrl {
return &QueryUrl{
Url: url,
}
}

// Int is a function for int
func (query *QueryUrl) Int(key string, defaultValue int) (int, error) {
values := query.Url[key]

Expand All @@ -30,6 +33,7 @@ func (query *QueryUrl) Int(key string, defaultValue int) (int, error) {
return int(val), nil
}

// Int64 is a function for int64
func (query *QueryUrl) Int64(key string, defaultValue int64) (int64, error) {
values := query.Url[key]

Expand All @@ -45,6 +49,7 @@ func (query *QueryUrl) Int64(key string, defaultValue int64) (int64, error) {
return int64(val), nil
}

// Str is a function
func (query *QueryUrl) Str(key string) (string, bool) {
values := query.Url[key]

Expand Down
1 change: 1 addition & 0 deletions src/server/backend/jwt.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/dgrijalva/jwt-go"
)

// GenerateToken is for generating token
func GenerateToken(userUUID string, role string) (string, error) {
token := jwt.New(jwt.SigningMethodHS256)
token.Claims = jwt.MapClaims{
Expand Down
1 change: 1 addition & 0 deletions src/server/backend/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"gopkg.in/mgo.v2/bson"
)

// FindNetworkByID is function for finding network by ID
func FindNetworkByID(session *mongo.Session, ID bson.ObjectId) (entity.Network, error) {
var network entity.Network
if err := session.FindOne(
Expand Down
2 changes: 2 additions & 0 deletions src/server/backend/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import (
"golang.org/x/crypto/bcrypt"
)

// HashPassword will hash password
func HashPassword(password string) (string, error) {
bytes, err := bcrypt.GenerateFromPassword([]byte(password), 14)
return string(bytes), err
}

// CheckPasswordHash will check password hash
func CheckPasswordHash(password, hash string) bool {
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
return err == nil
Expand Down
1 change: 1 addition & 0 deletions src/server/backend/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"gopkg.in/mgo.v2/bson"
)

// FindPodByID will find pod by ID
func FindPodByID(session *mongo.Session, ID bson.ObjectId) (entity.Pod, error) {
var pod entity.Pod
if err := session.FindOne(
Expand Down