§2023-07-08

$ git clone https://github.com/thejerf/markdir.git
$ cd markdir/
$ git tag
v1.0.0
v1.0.1
v1.0.2
$ git branch
* master
$ ls
go.mod  go.sum  LICENSE  markdir.go  README.md
$ go run markdir.go 
go: downloading github.com/russross/blackfriday v1.6.0
2023/07/13 14:20:34 Serving on http://127.0.0.1:19000

To build the Go module from the https://github.com/thejerf/markdir repository, you can follow these steps:

  1. Install Go: If you haven't already, install the Go programming language on your system. You can download it from the official Go website (https://golang.org) and follow the installation instructions specific to your operating system.

  2. Set up your Go workspace: Go expects your code to be organized in a specific directory structure called the "workspace." Create a workspace directory anywhere you like on your system. For example, you can create a directory called go in your home directory (~/go).

$ mkdir ~/GO
$ nano ~/.bashrc, add the following two lines 

# GO PTH
GOPATH=$HOME/GO

$ source ~/.bashrc
[alexlai@orangepi5 ~]$ echo $GOPATH
/opt/xfs/home/alexlai/GO
  1. Create the necessary directories: Inside your Go workspace directory, create the following directory structure:
go
└── bin
└── src
    └── github.com
        └── thejerf
            └── markdir

You can create the required directories manually or use the following commands:

mkdir -p $GOPATH/src/github.com/thejerf
cd $GOPATH/src/github.com/thejerf

Clone the repository: Use git to clone the markdir repository into the appropriate directory:

$ pwd
/opt/xfs/home/alexlai/GO/src/github.com/thejerf
$ git clone https://github.com/thejerf/markdir.git

Build and install the module: Once you have the repository cloned, navigate to the markdir directory and use the go install command to build and install the module:

cd markdir
go install

???The go install command will build the module and place the resulting binary in the $GOPATH/bin directory. Make sure that the $GOPATH/bin directory is in your system's PATH environment variable so that you can execute the markdir command from anywhere.

I have to cp it into $GOPATH/bin Verify the installation: To verify that the module is installed correctly, you can execute the markdir command and check if it runs without any errors:

If the command runs successfully, you have successfully built and installed the markdir module from the GitHub repository.

That's it! You should now have the markdir module installed and ready to use on your system.

# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
alias grep='grep --color=auto'
PS1='[\u@\h \W]\$ '

# fcitx5
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
 
# fix tilix error
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
        source /etc/profile.d/vte.sh
fi

# GO PTH
GOPATH=$HOME/GO

# export PATH
PATH=$HOME/GO/bin:$PATH
$ git clone https://github.com/thejerf/markdir
$ cd markdir
$ ls
go.mod  go.sum  LICENSE  markdir.go  README.md
$ git tag
v1.0.0
v1.0.1
v1.0.2
$ git checkout v1.0.2 -b v1.0.2
Switched to a new branch 'v1.0.2'