Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

cannot initialize 2 variables with 1 values

What’s wrong with this

m, err := os.Truncate(path,0)
    if err != nil {
        log.Printf("Failed to truncate: %v", err)
    }

if I do above I am getting an error like this

cannot initialize 2 variables with 1 values

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

while this works without an issue

if err := os.Truncate(path, 0); err != nil {
        log.Printf("Failed to truncate: %v", err)
    }

>Solution :

function os.Truncate will just affect the file in the path. Only return error, nothing else.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading