gossamer icon indicating copy to clipboard operation
gossamer copied to clipboard

Implement Go Standard Package folder structure

Open timwu20 opened this issue 5 years ago • 1 comments

Issue summary

  • Many go projects with external packages utilize the pkg and internal root level folders. Issue #1072 is looking to move SCALE into it's own package for external use. Migrating scale to the pkg folder is a nice compromise and we can always move it out into it's own repo afterwards.
  • Rename lib to internal. The go compiler enforces that external applications that import packages will not be able to import packages that stored in an internal folder.
  • Create the pkg folder with the intention of putting the finished package from #1072 into the pkg folder.
  • Audit the existing packages in lib and see which other packages we'd like to put in pkg.

Other information and links

  • https://github.com/golang-standards/project-layout

timwu20 avatar Apr 15 '21 15:04 timwu20

  • lib/trie/proof's trie proof verification
  • lib/trie's NewEmptyTrie() function and trie Put, Hash, Delete, methods are used here
  • pkg/scale is used by https://github.com/w3f/polkadot-tests/blob/9f9b437b716e6b9bb0a564563c7400b2c040234d/adapters/gossamer/scale_codec.go#L25
  • lib/common's Hash is used by https://github.com/w3f/polkadot-tests/blob/9f9b437b716e6b9bb0a564563c7400b2c040234d/adapters/gossamer/state_trie.go#L90
  • lib/runtime is used by https://github.com/w3f/polkadot-tests/tree/main/adapters/gossamer/host_api:
    • Instance by https://github.com/w3f/polkadot-tests/blob/9f9b437b716e6b9bb0a564563c7400b2c040234d/adapters/gossamer/host_api/allocator.go#L29
    • (TODO check other files)

Also see https://github.com/ChainSafe/gossamer/network/dependents?package_id=UGFja2FnZS0yMjY0OTQyMjIx

qdm12 avatar Sep 15 '22 16:09 qdm12