You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
Click here to show the 66 line(s) of Go which triggered the analyzer.
for_, datasource:=range*datasources {
notfounderror:=errors.New("No file found. Please check filename or path")
ifdatasource.Host!=""&&datasource.Host!="N/A"&&datasource.Name!="" {
ifdatasource.Protocol=="LOCAL" {
path:=strings.Replace(datasource.Host, "file://", "", -1)
_, notfounderror=os.Stat(path)
} elseifdatasource.Type=="API"||datasource.Protocol=="HTTP"||datasource.Protocol=="HTTPS" {
// note we are checking API HOST also as protocol used is HTTP/HTTPS for those datasources_, notfounderror=http.Get(datasource.Host)
} elseifdatasource.Protocol=="FTP"||datasource.Protocol=="FTPS" {
filename:=path.Base(datasource.Host)
// get server address and path of fileserver, path, err:=getFtpServer(datasource.Protocol, datasource.Host, filename)
// get client of ftp serverclient, err:=ftp.Dial(server)
iferr==nil {
// now connect to servererr:=client.Login(datasource.Ftpusername, datasource.Ftppassword)
// Close connectiondeferclient.Quit()
iferr==nil {
// change directory to pathclient.ChangeDir(path)
// get file entryentries, _:=client.List(filename)
iflen(entries) >0 {
notfounderror=nil
}
}
}
} elseifdatasource.Protocol=="SFTP" {
filename:=path.Base(datasource.Host)
// get server address and path of fileserver, path, err:=getFtpServer(datasource.Protocol, datasource.Host, filename)
// get client of ftp serverconfig:=&ssh.ClientConfig{
User: datasource.Ftpusername,
Auth: []ssh.AuthMethod{
ssh.Password(datasource.Ftppassword),
},
HostKeyCallback: ssh.InsecureIgnoreHostKey(),
//Ciphers: []string{"3des-cbc", "aes256-cbc", "aes192-cbc", "aes128-cbc"},
}
conn, err:=ssh.Dial("tcp", server, config)
iferr==nil {
client, err:=sftp.NewClient(conn)
// Close connectiondeferclient.Close()
deferconn.Close()
iferr==nil {
// change directory to pathcwd, err:=client.ReadDir(path) // []os.FileInfoiferr==nil {
ifcontains(cwd, filename) {
notfounderror=nil
}
}
}
}
} else {
// future implementation dataosurce with streams or other protocols
}
datasource.Available=notfounderror==nildatabase.DBInstance.UpdateDatasource(&datasource)
}
}
Click here to show extra information the analyzer produced.
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {UpdateDatasource 1} was not found in the callgraph; reference was passed directly to third-party code
Leave a reaction on this issue to contribute to the project by classifying this instance as a Bug 👎, Mitigated 👍, or Desirable Behavior 🚀
See the descriptions of the classifications here for more information.
Found a possible issue in databrokerglobal/dxc at datasources/host-check.go
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
Click here to see the code in its original context.
Click here to show the 66 line(s) of Go which triggered the analyzer.
Click here to show extra information the analyzer produced.
Leave a reaction on this issue to contribute to the project by classifying this instance as a Bug 👎, Mitigated 👍, or Desirable Behavior 🚀
See the descriptions of the classifications here for more information.
commit ID: b30274fcdbfe768b4350f346194abb54776009a0
The text was updated successfully, but these errors were encountered: