func (f *FTP) SendFile(remoteDir, remoteFile, localFile string) (err error) { var ( file *os.File ftp *goftp.FTP ) if ftp, err = goftp.Connect(f.host); err != nil { return } defer ftp.Close() if err = ftp.Login(f.user, f.pass); err != nil { return } if file, err = os.Open(localFile); err != nil { return } defer file.Close() if f.testMode { return } if err = ftp.Mkd(remoteDir); err != nil { return } if err = ftp.Cwd(remoteDir); err != nil { return } ftp.Stor(remoteFile, file) return }
func MakeBuildDir(ftp *goftp.FTP, dir string) { var err error if err = ftp.Mkd(dir); err != nil { panic(err) } }