Commit fbfe0540 authored by Loïck Bonniot's avatar Loïck Bonniot

[c][p][mails] Apply gosimple propositions

parent 6dcd836e
Pipeline #622 passed with stage
......@@ -76,10 +76,10 @@ Code lint:
- lint
script:
- "ln -s $(pwd) $GOPATH/src/dfss"
- "go get github.com/alecthomas/gometalinter"
- "go get -u github.com/alecthomas/gometalinter"
- "./build/deps.sh"
- "cd $GOPATH/src/dfss && make install_all"
- "gometalinter --install"
- "gometalinter --install --update"
- "gometalinter -t --deadline=600s -j1 --skip=api --skip=fixtures --skip=gui --skip=dfssd --disable=aligncheck ./..."
Deploy:
......
......@@ -44,12 +44,7 @@ func readPassphrases(keyPassphrase, confPassphrase *string, second bool) error {
}
fmt.Println("Enter the passphrase of your current key (if any)")
err = readPassword(keyPassphrase, false)
if err != nil {
return err
}
return nil
return readPassword(keyPassphrase, false)
}
// import the configuration
......
......@@ -81,12 +81,7 @@ func (m *AuthManager) Authenticate() error {
return err
}
err = m.evaluateResponse(response)
if err != nil {
return err
}
return nil
return m.evaluateResponse(response)
}
// Creates the associated authentication request and sends it to the platform grpc server
......@@ -117,10 +112,5 @@ func (m *AuthManager) sendRequest() (*pb.RegisteredUser, error) {
func (m *AuthManager) evaluateResponse(response *pb.RegisteredUser) error {
cert := []byte(response.ClientCert)
err := ioutil.WriteFile(m.fileCert, cert, 0600)
if err != nil {
return err
}
return nil
return ioutil.WriteFile(m.fileCert, cert, 0600)
}
......@@ -13,13 +13,7 @@ func Register(fileCA, fileCert, fileKey, addrPort, passphrase, country, organiza
if err != nil {
return err
}
err = manager.GetCertificate()
if err != nil {
return err
}
return nil
return manager.GetCertificate()
}
// Authenticate a user using the provided parameters
......@@ -28,13 +22,7 @@ func Authenticate(fileCA, fileCert, addrPort, mail, token string) error {
if err != nil {
return err
}
err = manager.Authenticate()
if err != nil {
return err
}
return nil
return manager.Authenticate()
}
func connect(fileCA, addrPort string) (pb.PlatformClient, error) {
......
......@@ -123,11 +123,7 @@ func (c *Config) checkData(keyPassphrase string) error {
}
_, err = auth.EncryptedPEMToPrivateKey(c.KeyData, keyPassphrase)
if err != nil {
return err
}
return nil
return err
}
// SaveUserInformations save the certificate and private key to the files specified in the Config struct
......
......@@ -68,12 +68,7 @@ func Initialize(bits, days int, country, organization, unit, cn, path string, ca
}
// Save the root certificate.
err = ioutil.WriteFile(certPath, cert, 0600)
if err != nil {
return err
}
return nil
return ioutil.WriteFile(certPath, cert, 0600)
}
// Start fetches the platform's private rsa key and root certificate, and create a PlatformID accordingly.
......
......@@ -44,7 +44,7 @@ func TestCloseWaitingGroup(t *testing.T) {
go func() {
myChan, _, _ := w.Join("A")
for _ = range myChan {
for range myChan {
t.Fatal("Should not be here")
}
// No need to call Unjoin here: if we do, we will try to unjoin a unknown room
......
......@@ -137,7 +137,7 @@ func FindAndUpdatePendingSigner(mail string, signersReady *[]bool, signers *[]en
// Check if everyone is ready
for _, s := range *signersReady {
if s == false {
if !s {
return
}
}
......
......@@ -143,11 +143,7 @@ func createFullMessage(b io.Writer, receiver, sender, globalHeader, base64Messag
return err
}
}
if err := writer.Close(); err != nil {
return err
}
return nil
return writer.Close()
}
// Create an attachment with a certain extension
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment