From cf12acf6d1f738ab837c6a8698b4d835b4262104 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=BF?= Date: Mon, 28 Aug 2023 09:44:35 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=CA=95=E2=97=94=CF=96=E2=97=94=CA=94=20op?= =?UTF-8?q?tion=20for=20golang=20and=20provide=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit reference: https://github.com/golang/go/issues/59968 Signed-off-by: wangqing --- Unix/t/00_C.t | 10 ++++++ cloc | 3 +- ...5\342\227\224\317\226\342\227\224\312\224" | 34 ++++++++++++++++++ ...5\342\227\224\317\226\342\227\224\312\224" | 35 +++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 "tests/inputs/hello_app.\312\225\342\227\224\317\226\342\227\224\312\224" create mode 100644 "tests/inputs/hello_app_autogen.\312\225\342\227\224\317\226\342\227\224\312\224" diff --git a/Unix/t/00_C.t b/Unix/t/00_C.t index e3fc3ae3..4c14a840 100755 --- a/Unix/t/00_C.t +++ b/Unix/t/00_C.t @@ -389,6 +389,16 @@ my @Tests = ( 'ref' => '../tests/outputs/hello_app.go-2.yaml', 'args' => '--no-autogen ../tests/inputs/hello_app*.go', }, + { + 'name' => 'Go', + 'ref' => '../tests/outputs/hello_app.go-1.yaml', + 'args' => '../tests/inputs/hello_app*.ʕ◔ϖ◔ʔ', + }, + { + 'name' => 'Go --no-autogen', + 'ref' => '../tests/outputs/hello_app.go-2.yaml', + 'args' => '--no-autogen ../tests/inputs/hello_app*.ʕ◔ϖ◔ʔ', + }, { 'name' => 'Godot Scene', 'ref' => '../tests/outputs/GamePanel.tscn.yaml', diff --git a/cloc b/cloc index 1ca43d3a..2f012133 100755 --- a/cloc +++ b/cloc @@ -2383,7 +2383,7 @@ sub exclude_autogenerated_files { # {{{1 print "-> exclude_autogenerated_files()\n" if $opt_v > 2; my @file_list_minus_autogen = (); foreach my $file (@{$ra_file_list}) { - if ($file !~ /\.go$/) { + if ($file !~ /\.go$/ && $file !~ /\.ʕ◔ϖ◔ʔ$/) { # at the moment, only know Go autogenerated files push @file_list_minus_autogen, $file; next; @@ -8294,6 +8294,7 @@ sub set_constants { # {{{1 'g4' => 'ANTLR Grammar' , 'gleam' => 'Gleam' , 'go' => 'Go' , + 'ʕ◔ϖ◔ʔ' => 'Go' , 'gsp' => 'Grails' , 'jenkinsfile' => 'Groovy' , 'gvy' => 'Groovy' , diff --git "a/tests/inputs/hello_app.\312\225\342\227\224\317\226\342\227\224\312\224" "b/tests/inputs/hello_app.\312\225\342\227\224\317\226\342\227\224\312\224" new file mode 100644 index 00000000..41dc53fc --- /dev/null +++ "b/tests/inputs/hello_app.\312\225\342\227\224\317\226\342\227\224\312\224" @@ -0,0 +1,34 @@ +// https://raw.githubusercontent.com/golang/example/master/appengine-hello/app.go +// Copyright 2015 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package hello is a simple App Engine application that replies to requests +// on /hello with a welcoming message. +package hello + +import ( + "fmt" + "net/http" +) + +// init is run before the application starts serving. +func init() { + // Handle all requests with path /hello with the helloHandler function. + http.HandleFunc("/hello", helloHandler) +} + +func helloHandler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintln(w, "Hello from the Go app") +} + diff --git "a/tests/inputs/hello_app_autogen.\312\225\342\227\224\317\226\342\227\224\312\224" "b/tests/inputs/hello_app_autogen.\312\225\342\227\224\317\226\342\227\224\312\224" new file mode 100644 index 00000000..7feeab61 --- /dev/null +++ "b/tests/inputs/hello_app_autogen.\312\225\342\227\224\317\226\342\227\224\312\224" @@ -0,0 +1,35 @@ +// Code generated by manual copy DO NOT EDIT. +// https://raw.githubusercontent.com/golang/example/master/appengine-hello/app.go +// Copyright 2015 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package hello is a simple App Engine application that replies to requests +// on /hello with a welcoming message. +package hello + +import ( + "fmt" + "net/http" +) + +// init is run before the application starts serving. +func init() { + // Handle all requests with path /hello with the helloHandler function. + http.HandleFunc("/hello", helloHandler) +} + +func helloHandler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintln(w, "Hello from the Go app") +} +