Skip to content

Commit 10ffec1

Browse files
committed
move main() to root directory
1 parent 0901981 commit 10ffec1

File tree

7 files changed

+16
-8
lines changed

7 files changed

+16
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Simple command line based HTTP file server to share local file system.
1515
## Compile
1616
Minimal required Go version is 1.18.
1717
```sh
18-
go build src/main.go
18+
go build main.go
1919
```
2020
Will generate executable file "main" in current directory.
2121

README.zh-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
## 编译
1616
至少需要Go 1.18版本。
1717
```sh
18-
go build src/main.go
18+
go build main.go
1919
```
2020
会在当前目录生成"main"可执行文件。
2121

build/build-docker-image-dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ COPY .git/ /go/src/mjpclab.dev/ghfs/.git/
33
COPY go.mod /go/src/mjpclab.dev/ghfs/go.mod
44
COPY src/ /go/src/mjpclab.dev/ghfs/src/
55
COPY build/ /go/src/mjpclab.dev/ghfs/build/
6-
RUN ["/bin/bash", "-c", "cd /go/src/mjpclab.dev/ghfs/build/; source ./build.inc.sh; go build -ldflags \"$(getLdFlags)\" -o /tmp/ghfs /go/src/mjpclab.dev/ghfs/src/main.go"]
6+
RUN ["/bin/bash", "-c", "cd /go/src/mjpclab.dev/ghfs/build/; source ./build.inc.sh; go build -ldflags \"$(getLdFlags)\" -o /tmp/ghfs /go/src/mjpclab.dev/ghfs/main.go"]
77
RUN mkdir -p /output/usr/local/bin/; cp /tmp/ghfs /output/usr/local/bin/;
88
COPY conf/docker-image/ /output/
99

build/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for build in "$@"; do
2424
BIN="$TMP/$MAINNAME$(go env GOEXE)"
2525
rm -f "$BIN"
2626
echo "Building: $GOOS$OS_SUFFIX $ARCH"
27-
go build -ldflags "$(getLdFlags)" -o "$BIN" ../src/main.go
27+
go build -ldflags "$(getLdFlags)" -o "$BIN" ../main.go
2828

2929
OUT="$OUTDIR/$MAINNAME-$VERSION-$GOOS$OS_SUFFIX-$GOARCH$ARCH_OPT".zip
3030
zip -j "$OUT" "$BIN" "$LICENSE"

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package main
2+
3+
import (
4+
"mjpclab.dev/ghfs/src"
5+
)
6+
7+
func main() {
8+
src.Main()
9+
}

src/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package src
22

33
import (
44
"errors"
@@ -35,7 +35,7 @@ func reopenLogOnHup(appInst *app.App) {
3535
}()
3636
}
3737

38-
func main() {
38+
func Main() {
3939
// params
4040
params, printVersion, printHelp, errs := param.ParseFromCli()
4141
serverError.CheckFatal(errs...)

test/main.bash

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ done
1313
export root=$(realpath .)
1414
export fs=$(realpath fs)
1515
export cert=$(realpath cert)
16-
export src=$(realpath ../src)
1716
export ghfs=$(realpath bin)/ghfs
1817
export GHFS_QUIET=1
1918

20-
go build -o "$ghfs" "$src/main.go"
19+
go build -o "$ghfs" "../main.go"
2120

2221
pattern="$1"
2322
if [ -z "$pattern" ]; then

0 commit comments

Comments
 (0)