{"id":83,"date":"2022-03-11T01:01:20","date_gmt":"2022-03-11T01:01:20","guid":{"rendered":"https:\/\/im8bit.com\/?p=83"},"modified":"2022-03-11T01:01:21","modified_gmt":"2022-03-11T01:01:21","slug":"go-programming-exporting-functions-structs-to-other-packages","status":"publish","type":"post","link":"https:\/\/im8bit.com\/?p=83","title":{"rendered":"GO programming: exporting functions, structs to other packages"},"content":{"rendered":"\n<p>So this is interesting and I found out only after facing the issue,<strong> <\/strong>in order to export a function to a different package the function should start with uppercase, and then while trying trying to use a struct from a different package I realize that this is also true for those and any other identifier, and sure enough, you can find that in the language spec:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>Exported identifiers<\/strong>\nAn identifier may be exported to permit access to it from another package. An identifier is exported if both:\n\n1. the first character of the identifier's name is a Unicode upper case letter (Unicode class \"Lu\"); and\n2. the identifier is declared in the package block or it is a field name or method name.\n\nAll other identifiers are not exported.\n<\/pre>\n\n\n\n<p>You can read more about it <a rel=\"noreferrer noopener\" href=\"https:\/\/go.dev\/ref\/spec#Exported_identifiers\" target=\"_blank\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So this is interesting and I found out only after facing the issue, in order to export a function to a different package the function should start with uppercase, and then while trying trying to use a struct from a different package I realize that this is also true for those and any other identifier, &#8230; <a class=\"read-more\" href=\"https:\/\/im8bit.com\/?p=83\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=83"}],"version-history":[{"count":1,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/im8bit.com\/index.php?rest_route=\/wp\/v2\/posts\/83\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/im8bit.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}