Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7637809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:01:32+00:00 2026-05-31T08:01:32+00:00

In Go, public names start with an upper case letter and private names start

  • 0

In Go, public names start with an upper case letter and private names start with a lower case letter.

I’m writing a program that is not library and is a single package. Is there any Go idiom that stipulates whether my identifiers should be all public or all private? I do not plan on using this package as a library or as something that should be imported from another Go program.

I can’t think of any reason why I’d want a mixture. It “feels” like going all private is the proper choice.


I don’t think I got any concrete answer, but Nate was closest with telling me to think of “exporting vs non-exporting” instead of “public and private”.

This leads me to believe that not exporting anything is the best approach. In the worst case scenario, if I end up importing code from my application in another package, I will have to rethink what should be exported and what shouldn’t be. Which is a good thing IMO.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:01:33+00:00Added an answer on May 31, 2026 at 8:01 am

    If you are attempting to adjust your mindset to be more Go idiomatic, you should stop thinking of variables, functions, and methods as public or private. The more accurate term is exported or not exported. It definitely has a more C like feel to it.

    As others have stated exporting really isn’t needed for application program code. If for organizational reasons you decide to break your program up into packages, you could use sub-packages. At work we’ve decided to do just this. We have:

    projectgopath/src/projectname
                      projectname/subcomponent1
                      projectname/subcomponent2
    

    So far I am really liking this structure. It aids in separation of concerns, but does not go to the extent of making a package outside of the main project. The intent is clear. The sub-package’s intended use is for this program only…

    The new go build and go install commands seem to deal very well with it. We group components together in packages and expose only the necessary bits via exports.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The convention says: Non-public, non-static field names start with m. Other fields start with
I have the following code (changed object names, so syntax/spelling errors ignore). public class
struct Drink { public string Name { get; private set; } public int Popularity
alt text http://img24.imageshack.us/img24/3365/sqlnuts.jpg well heres the code public void select_table_names() {//start /* display all
Here http://source.android.com/source/code-style.html#follow-field-naming-conventions it is stated that : Field Names Non-public, non-static field names start
I have to write a program that read from a file that contains the
Here is a quick test program: public static void main( String[] args ) {
I'll start with some classes... The Domain Entity: public class Account { public int
I am making an EmployeeStore that will store names, dob, id, email address etc...
Lets start off with a list of strings that will be used to filter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.