golang ftp

package main

import (
    "bytes"
    "log"
    "net/http"
    "os"
    "time"

    ftp "github.com/secsy/goftp"
)

func main() {
    err := downLoadFile()
    if err != nil {
        log.Fatal(err)
    }
}

func downLoadFile() error {
    config := ftp.Config{
        User:               "{ユーザーID}",
        Password:           "{パスワード}",
        ConnectionsPerHost: 10,
        Timeout:            10 * time.Second,
        Logger:             os.Stderr,
    }
    client, err := ftp.DialConfig(config, "172.19.2.12")
    if err != nil {
        panic(err)
    }

    // Download a file to disk
    readme, err := os.Create("readme")
    if err != nil {
        panic(err)
    }

    err = client.Retrieve("test.csv", readme)
    if err != nil {
        panic(err)
    }

    return nil
}