Hello everyone out there, I've written the following code inside a package
import "gitlab.bertha.cloud/partitio/Nextcloud-Partitio/gonextcloud"
type ConfigNextCloud struct {
URL string `json:"url"`
Username string `json:"username"`
Password string `json:"password"`
}
func LoadNextCloudProperty(fullFileName string) (ConfigNextCloud, error) { // fullFileName for fetching database credentials from given JSON filename.
var configNextCloud ConfigNextCloud
// Open and read the file
fileHandle, err := os.Open(fullFileName)
if err != nil {
return configNextCloud, err
}
defer fileHandle.Close()
jsonParser := json.NewDecoder(fileHandle)
jsonParser.Decode(&configNextCloud)
// Display Information about NextCloud Instance.
fmt.Println("Read NextCloud configuration from the ", fullFileName, " file")
fmt.Println("URL\t", configNextCloud.URL)
fmt.Println("Username \t", configNextCloud.Username)
fmt.Println("Password \t", configNextCloud.Password)
return configNextCloud, nil
}
func ConnectToNextCloud(fullFileName string) (*gonextcloud.Client, error) {
configNextCloud, err := LoadNextCloudProperty(fullFileName)
//
if err != nil {
log.Printf("Loading NextCloudProperty: %s\n", err)
return nil, err
}
fmt.Println("Connecting to NextCloud...")
nextCloudClient, err := gonextcloud.NewClient(configNextCloud.URL)
if err != nil {
fmt.Println("Client creation error:", err)
}
if err = nextCloudClient.Login(configNextCloud.Username, configNextCloud.Password); err != nil {
fmt.Println("Login Error", err)
}
defer nextCloudClient.Logout()
return nextCloudClient, err // return the NextcloudClient created to perform the download and store actions
}
The package containing the aboce code is used in another file.
And the complete project has been deployed on github. When I'm trying to run the go get
command to install the project I'm getting the following warning:
cannot use nextCloudClient (type gonextcloud.Client) as type *gonextcloud.Client in return argument:
*gonextcloud.Client is pointer to interface, not interface
Although, the code shows no errors when I'm running the go build
command.
Please help me with this peculiar issue.