A question about using ioutil package(from newbie)

pkg.go.dev/io/ioutil says “As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code.”
Does this mean?: using directly package io or os is enough and better than ioutil. so do not use ioutil.

If so, why isn’t this package removed from standard go library? I know Go aims simplicity. Wouldn’t it be better if the non-recommended package was removed?

If i wrong, excuse me :slight_smile:

Note: I am newbie about programming. Thanks.

Hello, it is very common to every programming language maintain the oldest functions/libraries, if it is not a bug for sure. This happen because if it was removed, old codes should be rewrite from scratch, unexpected incompatibilities would appear, and also the maintaining of old codes would be very hard.


Because Go made a promise to be backward compatible for Go 1 - Go 1 and the Future of Go Programs - The Go Programming Language

Further clarified in Frequently Asked Questions (FAQ) - The Go Programming Language


The APIs may grow, acquiring new packages and features, but not in a way that breaks existing Go 1 code.

Generally, it is an industrial practices to be backward-compatible whenever possible.

Delete - strictly speaking, is a 1-way action where deleted entity are usually unrecoverable, thus breaking the user experience in terms of expectation. Go is used in many critical system worldwide and introduce a small breaking changes without careful planning and communications can be disastrous.

1 Like