# Use internal packages to reduce your public API surface

DevFeed: [Use internal packages to reduce your public API surface](<https://devfeed.tech/articles/use-internal-packages-to-reduce-your-public-api-surface-20820.md>)

Original publisher: [Read original article](<https://dave.cheney.net/2019/10/06/use-internal-packages-to-reduce-your-public-api-surface>)

Author: Dave Cheney

Published: 2019-10-06T04:43:54Z

Content type: article

Language: en

Sources: [Dave Cheney](<https://devfeed.tech/sources/dave-cheney.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Tool](<https://devfeed.tech/topics/tool.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [library](<https://devfeed.tech/tags/library.md>), [pkg](<https://devfeed.tech/tags/pkg.md>), [programming](<https://devfeed.tech/tags/programming.md>), [project-layout](<https://devfeed.tech/tags/project-layout.md>)

## AI overview

This article explains how Go internal packages restrict imports to a defined directory tree, helping project authors keep implementation details out of the public API. Packages can later be promoted if the author chooses to support them publicly.

## Source excerpt

In the beginning, before the go tool, before Go 1.0, the Go distribution stored the standard library in a subdirectory called pkg/ and the commands which built upon it in cmd/. This wasn't so much a deliberate taxonomy but a by product of the original make based build system. In September 2014, the Go distribution [...]