Modules and Packages
In a module, you collect one or more related packages for a discrete and useful set of functions. For example, you might create a module with packages that have functions for doing financial analysis so that others writing financial applications can use your work.
By Go definition of Packages and Modules.
Note: Let's create a folder called fourier where the module will reside
sh
            [Golang]$ mkdir fourier
[Golang]$ cd fourier 
[fourier]$
          
Now onto starting the module. Ensure Node is installed for JS modules to be created and it exists from the terminal.
Note: Dart has the dart create fourier for creating an application, its dependency file (pubspec.yaml), the bin, lib and test folders. But for the sake of understanding what happens under the hood, let's build the project from scratch
go
js
dart
            [fourier]$ go mod init example.com/fourier
go: creating new go.mod: module example.com/fourier
[fourier]$ ls
go.mod
          
Before sdk is indentation of spaces (tab cannot be used) so that it can be as below:
name: fourier

environment:
  sdk: '>=2.18.2'
Creating the root file for the module
go
js
dart
py
julia
            [fourier]$ touch main.go
          
In dart, the core project file in bin needs to be the same as the project name itself

Write the code below into the file and save it.
go
js
dart
py
julia
package main

import "fmt"

func main () {
    fmt.Println("Hello world")
}
'use strict';

/*
in strict mode, declaring variables have to have
let or var before it, for instance, to execute

a = 5 // this fails with strict, works otherwise
let a = 5 // it has to be this way
*/

console.log("Hello World")
void main () {
  print("Hello World");
}
print("Hello World")
module Fourier

println("Hello World")

end
Note: For JS, modify scripts object of package.json to be as below
            {
"name": "fourier",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
    "start": "node main.js",
    "test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
          
Now onto running the code
go
js
dart
py
julia
            # ensure you are in root folder, fourier
go run .
          
Call code from another module
From our root folder fourier, let's create another folder hello. After you create it and initialize an empty file, directory structure should be as below:
go
js
dart
py
julia
            [fourier]$ mkdir hello
[fourier]$ touch hello/hello.go
[fourier]$ ls *
go.mod  main.go

hello:
hello.go
          
For Go, we'll have to initialize go.mod in the hello folder to keep track of installed third-party packages in that module. Since that module still exists locally, we need to use go mod edit command to redirect Go tools from its (remote) module path to local directory
go
            [fourier]$ cd hello
[hello]$ ls
hello.go   
[hello]$ go mod init example.com/fourier/hello               
go: creating new go.mod: module example.com/fourier/hello                          
go: to add module requirements and sums:
        go mod tidy
[hello]$ cd ../
[fourier]$ go mod edit -replace example.com/fourier/hello=./hello
[fourier]$ cat go.mod
module example.com/fourier

go 1.18

replace example.com/fourier/hello => ./hello
[fourier]$
          
Now onto writing code to our local module file and saving it. Note that the functions must start with Capital letters in Go for them to be public
go
js
dart
py
julia
package hello

import (
  "fmt"
  "runtime"	
)

func SayArch() string {
  arch := fmt.Sprintf("Architecture: %s", runtime.GOOS)
  return arch
}
const os = require('os')

// create anonymous function and bind to variable SayArch
const SayArch = () => {
  let arch = "OS info: \n"
  arch += `Type ${os.type()} ` +
            `Release: ${os.release()} ` +
            `Platform: ${os.platform()}`
  return arch
}

module.exports = { SayArch }
import "dart:io";

String SayArch() {
  var uri = Platform.operatingSystem.toString();
  return uri;
}
import platform

def SayArch() -> str :
    arch = f"Architecture : {platform.system()} {platform.release()}"
    return arch
module Hello
export SayArch 

#=
In Julia, functions can automatically return the last expression avaluated as the output
=#
function SayArch()::String
    arch::String = "Architecture : $(Sys.ARCH) $(Sys.MACHINE)"
end

end
Now our main file in root becomes
go
js
dart
py
julia
package main

import (
  "fmt"
  "example.com/fourier/hello"
)

func main () {
  fmt.Println("Hello world")
  arch := hello.SayArch()
  fmt.Println(arch)
}
'use strict';

const { SayArch } = require('./hello/hello.js')

console.log("Hello World")
let arch = SayArch()
console.log(arch)
import 'package:fourier/hello/hello.dart';
/*
OR
import 'package:fourier/hello/hello.dart' as hello;
Then access functions as hello.SayArch();
*/

void main() {
  print("Hello World");
  print(SayArch());
}
from hello.hello import SayArch

# OR
#from hello import hello
# arch = hello.SayArch() 

print("Hello World")
arch = SayArch()
print(arch)
module Fourier

include("hello/hello.jl")

println("Hello World $(Base.:+(1, 2, 3))")
println(Hello.SayArch())
end
Code output when running it becomes
go
js
dart
py
julia
            [fourier]$ go mod tidy
go: found example.com/fourier/hello in example.com/fourier/hello v0.0.0-00010101000000-000000000000
[fourier]$ go run .
Hello world
Architecture: darwin
[fourier]$
          
Note: More info on how to use go.work for multimodule workspace is further documented on Go Multimodules
For Node (JS) Projects, TypeScript is recommended for type hinting to highly reduce errors in scalable projects. To configure it, use the documentation available in TS Configuration