From a683fdb471260511fd3ffcba6450564084d00b3b Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Mon, 5 Aug 2024 16:57:03 -0500 Subject: [PATCH] go: update to ubuntu:24.04 and convert to go.mod style --- impls/go/Dockerfile | 7 +++++-- impls/go/Makefile | 4 +--- impls/go/src/core/core.go | 8 ++++---- impls/go/src/env/env.go | 2 +- impls/go/src/printer/printer.go | 2 +- impls/go/src/reader/reader.go | 2 +- impls/go/src/step0_repl/step0_repl.go | 2 +- impls/go/src/step1_read_print/step1_read_print.go | 8 ++++---- impls/go/src/step2_eval/step2_eval.go | 8 ++++---- impls/go/src/step3_env/step3_env.go | 10 +++++----- impls/go/src/step4_if_fn_do/step4_if_fn_do.go | 12 ++++++------ impls/go/src/step5_tco/step5_tco.go | 12 ++++++------ impls/go/src/step6_file/step6_file.go | 12 ++++++------ impls/go/src/step7_quote/step7_quote.go | 12 ++++++------ impls/go/src/step8_macros/step8_macros.go | 12 ++++++------ impls/go/src/step9_try/step9_try.go | 12 ++++++------ impls/go/src/stepA_mal/stepA_mal.go | 12 ++++++------ 17 files changed, 69 insertions(+), 68 deletions(-) diff --git a/impls/go/Dockerfile b/impls/go/Dockerfile index f306c03f42..1eae538c9d 100644 --- a/impls/go/Dockerfile +++ b/impls/go/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:24.04 MAINTAINER Joel Martin ########################################################## @@ -19,4 +19,7 @@ WORKDIR /mal # Specific implementation requirements ########################################################## -RUN DEBIAN_FRONTEND=noninteractive apt-get -y install g++ golang libedit-dev pkg-config +RUN DEBIAN_FRONTEND=noninteractive apt-get -y install g++ golang libreadline-dev libedit-dev pkg-config + +ENV HOME /mal +ENV GOPATH /mal/impls/go/ diff --git a/impls/go/Makefile b/impls/go/Makefile index f2094e8e14..4968b59cf0 100644 --- a/impls/go/Makefile +++ b/impls/go/Makefile @@ -1,5 +1,3 @@ -export GOPATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) - ##################### SOURCES_BASE = src/types/types.go src/readline/readline.go \ @@ -24,7 +22,7 @@ mal: $(word $(words $(BINS)),$(BINS)) define dep_template $(1): $(SOURCES_BASE) src/$(1)/$(1).go - go build $$@ + go build -o $$@ ./src/$(1) endef $(foreach b,$(BINS),$(eval $(call dep_template,$(b)))) diff --git a/impls/go/src/core/core.go b/impls/go/src/core/core.go index 2f980fd7f1..dad54222c7 100644 --- a/impls/go/src/core/core.go +++ b/impls/go/src/core/core.go @@ -9,10 +9,10 @@ import ( ) import ( - "printer" - "reader" - "readline" - . "types" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // Errors/Exceptions diff --git a/impls/go/src/env/env.go b/impls/go/src/env/env.go index 88098fcc0a..0c3ed5b8b2 100644 --- a/impls/go/src/env/env.go +++ b/impls/go/src/env/env.go @@ -6,7 +6,7 @@ import ( ) import ( - . "types" + . "mal/src/types" ) type Env struct { diff --git a/impls/go/src/printer/printer.go b/impls/go/src/printer/printer.go index 016e65f8d8..34cda90cb9 100644 --- a/impls/go/src/printer/printer.go +++ b/impls/go/src/printer/printer.go @@ -6,7 +6,7 @@ import ( ) import ( - "types" + "mal/src/types" ) func Pr_list(lst []types.MalType, pr bool, diff --git a/impls/go/src/reader/reader.go b/impls/go/src/reader/reader.go index 49d8add63a..b3fdc61c28 100644 --- a/impls/go/src/reader/reader.go +++ b/impls/go/src/reader/reader.go @@ -9,7 +9,7 @@ import ( ) import ( - . "types" + . "mal/src/types" ) type Reader interface { diff --git a/impls/go/src/step0_repl/step0_repl.go b/impls/go/src/step0_repl/step0_repl.go index 644a087f3f..052591e54c 100644 --- a/impls/go/src/step0_repl/step0_repl.go +++ b/impls/go/src/step0_repl/step0_repl.go @@ -6,7 +6,7 @@ import ( ) import ( - "readline" + "mal/src/readline" ) // read diff --git a/impls/go/src/step1_read_print/step1_read_print.go b/impls/go/src/step1_read_print/step1_read_print.go index f4c4115a7c..09e1957215 100644 --- a/impls/go/src/step1_read_print/step1_read_print.go +++ b/impls/go/src/step1_read_print/step1_read_print.go @@ -6,10 +6,10 @@ import ( ) import ( - "printer" - "reader" - "readline" - . "types" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step2_eval/step2_eval.go b/impls/go/src/step2_eval/step2_eval.go index f73edac623..b24f858831 100644 --- a/impls/go/src/step2_eval/step2_eval.go +++ b/impls/go/src/step2_eval/step2_eval.go @@ -7,10 +7,10 @@ import ( ) import ( - "printer" - "reader" - "readline" - . "types" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step3_env/step3_env.go b/impls/go/src/step3_env/step3_env.go index bd3cd783f4..0f199e1a5f 100644 --- a/impls/go/src/step3_env/step3_env.go +++ b/impls/go/src/step3_env/step3_env.go @@ -7,11 +7,11 @@ import ( ) import ( - . "env" - "printer" - "reader" - "readline" - . "types" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step4_if_fn_do/step4_if_fn_do.go b/impls/go/src/step4_if_fn_do/step4_if_fn_do.go index 4098a18fa8..9de8d00a30 100644 --- a/impls/go/src/step4_if_fn_do/step4_if_fn_do.go +++ b/impls/go/src/step4_if_fn_do/step4_if_fn_do.go @@ -7,12 +7,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step5_tco/step5_tco.go b/impls/go/src/step5_tco/step5_tco.go index 841354eef1..7205fc805d 100644 --- a/impls/go/src/step5_tco/step5_tco.go +++ b/impls/go/src/step5_tco/step5_tco.go @@ -7,12 +7,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step6_file/step6_file.go b/impls/go/src/step6_file/step6_file.go index 5329b90f06..88128d30f1 100644 --- a/impls/go/src/step6_file/step6_file.go +++ b/impls/go/src/step6_file/step6_file.go @@ -8,12 +8,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step7_quote/step7_quote.go b/impls/go/src/step7_quote/step7_quote.go index 78356b2ce5..11832eb622 100644 --- a/impls/go/src/step7_quote/step7_quote.go +++ b/impls/go/src/step7_quote/step7_quote.go @@ -8,12 +8,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step8_macros/step8_macros.go b/impls/go/src/step8_macros/step8_macros.go index 63af7f71a2..762dcaf374 100644 --- a/impls/go/src/step8_macros/step8_macros.go +++ b/impls/go/src/step8_macros/step8_macros.go @@ -8,12 +8,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/step9_try/step9_try.go b/impls/go/src/step9_try/step9_try.go index 0360cc6d4c..ddc8a77435 100644 --- a/impls/go/src/step9_try/step9_try.go +++ b/impls/go/src/step9_try/step9_try.go @@ -8,12 +8,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read diff --git a/impls/go/src/stepA_mal/stepA_mal.go b/impls/go/src/stepA_mal/stepA_mal.go index cd7c614f54..2ff77563c9 100644 --- a/impls/go/src/stepA_mal/stepA_mal.go +++ b/impls/go/src/stepA_mal/stepA_mal.go @@ -8,12 +8,12 @@ import ( ) import ( - "core" - . "env" - "printer" - "reader" - "readline" - . "types" + "mal/src/core" + . "mal/src/env" + "mal/src/printer" + "mal/src/reader" + "mal/src/readline" + . "mal/src/types" ) // read