2023,江端さんの忘備録

以前、「めんつゆ」「コロッケ」「クロワッサン」の偉大さについて書いたことがあります。

I have previously written about the greatness of mentsuyu, croquettes, and croissants.

ですから、「ポテトサラダ」や「冷凍餃子」を使うことを「手抜き」であると批難した人は、まず私のところに来て下さい。

また、レトルト食品のアレンジ方法についても紹介しました。

Also I presented how to arrange retort foods.

まあ、それでも、レトルトカレーの域を出ることはないのですが ―― 結構、いけます。

最近、レトルトのパスタソースの味も、シャレにならないくらい美味しいです。

Lately, retort pasta sauces have tasted, no pun intended, delicious.

自分の好きな具材(ナス、ニンニク、ホウレンソウ、しめじ、鶏肉、その他)を適当に炒めておいて、このパスタソースを投入するだけで ――

Simply saute my favorite ingredients (eggplant, garlic, spinach, shimeji mushrooms, chicken, etc.) and add this pasta sauce.

間違いなく、その辺のイタリアンファミリーレストランには負けないくらいの、美味しいパスタになっていると思います。

Without a doubt, the pasta is as good as any Italian family restaurant in the area.

-----

―― とは言え、正直、よく分かりません。

-- However, I honestly don't know.

なぜなら、私は、まだ、その店に来店したことがないからです。

Because I have yet to visit the restaurant.

あるアニメの主人公(俺の青春ラブコメは・・・)が、この店を必要に推してくるので、今、私は、そのレストランに対する期待が、恐しい程に高まっているのです。

The main character in an anime (My Youth Love Comedy is...) makes a necessary push for this restaurant, and now my expectations for the restaurant have risen to a frightening degree.

『もしかしたら、ガッカリすることになるかもしれない』と思うと、どうしても、来店に二の足を踏んでしまうのです。

Tkinking 'Maybe I'll be disappointed,' I cannot help to hesitate to go to the restaurant.

2023,江端さんの忘備録

私は、『他人に自分の人生論を垂れる奴が大嫌い』ということを言い続けてきましたので、基本的に、そういうことはしません。

I have always said, 'I hate people who hang their life theories on others,' so basically, I don't do that.

仮に、自分の目の前に「これから失敗することが確実な人間」がいても、助言しません。

Even if there is a person in front of me who is certain to fail in the future, I would not advise him.

―― 笑顔を浮べながら、そいつが沈んでいくのを見続ける

"Keep smiling and watch that guy sink"

というのが、私のスタンスです。

That is my stance.

で、まあ、私自身、そういう風に、なんども"沈没"を続けてきましたが、それで良かったと思っています。

And, well, I have "sunk" many times in that way, and I am glad that I did.

私には『失敗する権利がある』と思っているからです。

Because I believe that I have the 'right to fail.

『"失敗"からしか学べないなら、学ぶためには"失敗"し続けなければならない』

自分の子どもであっても、同じスタンスです ―― もっとも、彼女らの生命と財産に関わることは、除きますが。

Even my own children, I take the same stance -- except when it comes to their lives and property.

-----

という訳で、大抵の場合、私は娘たちに語るかけることはしませんが、娘たちの方から相談されることはあります(主に長女)。

So, for the most part, I don't talk to my daughters about it, but they do ask me for advice (mainly my seior daughter).

彼女の相談の内容を纏めますと、

To summarize her consultation,

―― 多角的な視野をもって、上手く仕事を回したい

"I want to work well with multiple perspectives"

ということです。

江端:「大丈夫。年齢を重ねるだけで、ほっといても『多角的な視野』になるよ。なにしろ無駄に生きているんだから」

Ebata: "Don't worry. Just getting older will give you a 'multifaceted perspective' even if you leave it alone. After all, we all are living in vain.

長女:「今、すぐに、"そう"なりたい」

She: "Right now, I want to be 'so'."

江端:「それは、無理かなぁ。『若い』というのは、能力と関係なく『舐められる』運命にあるから」

Ebata: I don't know it is easy. Because 'young' is destined to be 'licked' regardless of ability.

長女:「能力は、評価されないの?」

She:"Isn't ability appreciated?"

江端:「能力って、評価が難しいんだよ ―― 例えば、私が20歳代にやってきた時『バカ、アホ』と言われたことを、今やると『流石は、江端さんですね。素晴しい』って言われるぞ」

Ebata: "Ability is difficult to evaluate. For example, when I was in my 20s, people said I was stupid or an idiot, but when I do it now, they say 'You are a brilliant person!"

長女:「・・・」

She:"..."

江端:「という訳で、『他人の評価は、受け流す』で、いいと思うぞ」

Ebata: "So, I think it's good that you should just 'let other people's evaluations slide".

-----

『人の意見を真に受けて、自分のやりたいことを止めてしまうことが、一番バカバカしい』

'The most ridiculous thing you can do is stop yourself from doing what you want to do because of the opinions of others.'

とは、多くの人も言っていますが、

Many people said that, however, I am afraid that they don't say

『それに気がつくのは、人生のラストイニングあたりである』

"You don't realize it until the last inning of your life"

ということは、あまり語られていないように思います。

2023,江端さんの忘備録

最近、映画「八甲田山」と「二百三高地」を見直したのですが、『もの凄い映画だなぁ』と感嘆しました。

I recently reviewed the movies "Hakkoudasan" and "Nihyaku san Kochi" and marveled at what a great movie they are.

アナログ実写の迫力もさることながら、おそらくはロケ地の劣悪な環境下での疲労困憊の役者やエキストラの血を吐くような演技が ―― ぶっちゃけ『怖い』。

The power of the analog live action, as well as the blood-curdling performances of the exhausted actors and extras, probably under the poor conditions of the location, are honestly 'scary'.

最近の映画が、今一つ面白くないのは、映像のデジタル化かのためかなぁ、と思うのですよね。

I wonder if the reason why movies these days are not as interesting as they used to be is because of the digitalization of images.

―― というのが、一つの仮説です。

-- is one hypothesis.

ところが、私には、もう一つの仮説があります。

However, I have another hypothesis.

それは、『単に、私が若い頃に慣れ親しんでいる映像に、私が洗脳されているだけ』というものです。

It is, 'I am simply brainwashed by the images I am familiar with from my youth.

-----

『ションコネリー以外の007はカスだ』といっていた著名人がいましたが、私は『ロジャームーアの007』の方が面白いと思っています。

There was a celebrity who said, "007 other than Shon Connery is scum," but I think "Roger Moore's 007" is more interesting.

また、私が実家に帰省した時に、父は、私に1950-60年代のハリッド映画を見せようとしていましたが、私には、その面白みが全く伝わってきませんでした。

Also, when I went back home, my father tried to show me halid films from the 1950s and 1960s, but I never found them interesting.

つまり、「その人間にとって、特に多感な時代に刷り込まれた(映画の)記憶が、その後の価値基準になる」、つまり『すりこみ』です。

"The memories (of films) imprinted on a person, especially during his or her impressionable years, become the standard of value thereafter", in other words, "slip-in".

『自分にとって最上と思っているモノやコトが、他の人にとっては論外である』ということは、普通にあると思います。

It is common for people to say, "What I consider to be the best thing for me is out of the question for others".

-----

20年後に、私の孫が存在するどうかは分かりませんが ―― その孫に『シュタインズ・ゲート』を見せたら、どういう感想を持つのだろうか、と考えると、ドキドキします。

I don't know if my grandchildren will exist 20 years from now -- but I get nervous thinking about what they will think of "Steins;Gate" when I show it to them.

もし、孫が『面白い』と言ったら、私は孫にお年玉を沢山渡すだろうと思います。

If my grandson says 'that's great' I will probably give him a lot of New Year's money.

2023,江端さんの忘備録

現在、私は3つのプロジェクトに属していますが、3つのプロジェクトリーダーの全員が女性です。

Currently I am part of three projects and all three project leaders are women.

―― ということに、今さらながら、気がつきました。

I realize that now.

当然ですが、全員が年下です ―― というか、単に私が"シニア"というだけのことですが。

Of course, they are all younger than me -- or rather, I am simply a "senior".

仕事に関して『問題がない』というか『問題を認識できない』です。

I don't have a problem with my work, or rather, I can't recognize a problem.

私が不当に忖度(そんたく)されているという可能性 ―― いや、それは、"ない"と思う。

The possibility that I am being unfairly given careful consideration -- no, I don't think so.

私には人事権などの裁量が全くないですから。

I have absolutely no discretionary authority over personnel matters.

-----

ちなみに、私は、私を気持ちよく働かせてくれるのであれば、リーダーの性別や年齢に興味はなく、機械(AI?)に指示されたって、一向に構いません。

By the way, I am not interested in the gender or age of the leader, as long as they make me feel good about working for them. I don't mind being directed by a machine (AI?).

2023,江端さんの技術メモ

ODデータ(csv):20220518weekday

領域データ(csv):yamaguchi_area

出力データ(csv):new_20220518weekday

その他: 年齢を乱数を使って適当に作成しているコードも入っている

// ~/yamaguchi/src_try1/others/main61.go

// Usage: go run main61.go 20220518weekday.csv new_20220518weekday.csv

package main

import (
	"database/sql"
	"encoding/csv"
	"fmt"
	"log"
	"math/rand"
	"os"
	"strconv"

	_ "github.com/lib/pq"
)

func main() {

	file, err := os.Open("yamaguchi_area.csv")
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	r := csv.NewReader(file)
	rows, err := r.ReadAll() // csvを一度に全て読み込む
	if err != nil {
		log.Fatal(err)
	}

	str := "SELECT ST_Covers(st_geomfromtext('POLYGON(("

	// 行ごとに
	for i, row := range rows {
		if i == 0 {
			continue // CSVのヘッダー行を無視
		}

		str += row[1] + " " + row[2] + ", " // rowのままで取り出せば、文字列になっている

	}
	str1 := str[:len(str)-2] + "))'),st_geomfromtext('LINESTRING(" // 上記の最後の", "を削除して、文字列を追加

	dbMap, err := sql.Open("postgres",
		"user=postgres password=password host=192.168.0.23 port=15432 dbname=yama_db sslmode=disable")
	log.Println("------------------ map db open ------------------")
	if err != nil {
		log.Fatal("OpenError: ", err)
	}
	defer dbMap.Close()

	///////////////////////////////////////

	//file2, err2 := os.Open("20220518weekday.csv")
	file2, err2 := os.Open(os.Args[1]) // 第1パラメータ
	if err2 != nil {
		log.Fatal(err2)
	}
	defer file2.Close()

	r2 := csv.NewReader(file2)
	rows2, err2 := r2.ReadAll() // csvを一度に全て読み込む
	if err != nil {
		log.Fatal(err2)
	}

	file3, err3 := os.Create(os.Args[2]) // 第2パラメータ
	if err3 != nil {
		panic(err)
	}

	w := csv.NewWriter(file3)

	var id int

	for _, row := range rows2 {
		//if i == 0 {
		//	continue // CSVのヘッダー行を無視
		//}

		str2 := str1 + row[0] + " " + row[1] + ", " + row[2] + " " + row[3]

		str2 += ")'))"

		fmt.Println(str2)

		rows1, err := dbMap.Query(str2)
		if err != nil {
			log.Fatal(err)
		}
		defer rows1.Close()

		//var dt string
		var dt bool

		for rows1.Next() {
			if err := rows1.Scan(&dt); err != nil {
				fmt.Println(err)
			}
			// fmt.Println(dt)
			if dt {

				//if err := rows.Scan(&id, &age, &type1, &departure_name, &departure_number, &departure_lat, &departure_lng, &arrival_name, &arrival_number, &arrival_lat, &arrival_lng); err != nil {
				//	fmt.Println(err)
				// 上記のSQLのフォームと同じ形でcsvファイルを作る

				var age int

				fmt.Println("row[4]:", row[4])

				// id_str := strconv.Itoa(id) // idを文字列に
				if row[4] == "10-15" {
					age = 10 + rand.Intn(5)
				} else if row[4] == "15-29" {
					age = 15 + rand.Intn(5)
				} else if row[4] == "20-24" {
					age = 20 + rand.Intn(5)
				} else if row[4] == "25-29" {
					age = 25 + rand.Intn(5)
				} else if row[4] == "30-34" {
					age = 30 + rand.Intn(5)
				} else if row[4] == "35-39" {
					age = 35 + rand.Intn(5)
				} else if row[4] == "40-44" {
					age = 40 + rand.Intn(5)
				} else if row[4] == "44-49" {		
					age = 45 + rand.Intn(5)
				} else if row[4] == "50-54" {
					age = 50 + rand.Intn(5)
				} else if row[4] == "55-59" {
					age = 55 + rand.Intn(5)
				} else if row[4] == "60-64" {
					age = 60 + rand.Intn(5)
				} else if row[4] == "65-69" {
					age = 65 + rand.Intn(5)
				} else if row[4] == "70-74" {
					age = 70 + rand.Intn(5)
				} else if row[4] == "75-80" {
					age = 75 + rand.Intn(5)
				} else if row[4] == "80-84" {
					age = 80 + rand.Intn(5)
				} else if row[4] == "85-89" {
					age = 85 + rand.Intn(5)
				} else if row[4] == "90-94" {
					age = 90 + rand.Intn(5)
				} else if row[4] == "95-99" {
					age = 95 + rand.Intn(5)
				} else {
					age = 15 + rand.Intn(65) // 15箸キ79までの乱数
				}

				type1 := "resident"
				departure_name := ""
				_row1, _ := strconv.ParseFloat(row[1], 64)
				_row0, _ := strconv.ParseFloat(row[0], 64)

				departure_number, departure_lng, departure_lat := fixPosition(dbMap, _row1, _row0) // row[1], row[0]の順番に注意

				arrival_name := ""
				_row3, _ := strconv.ParseFloat(row[3], 64)
				_row2, _ := strconv.ParseFloat(row[2], 64)
				arrival_number, arrival_lng, arrival_lat := fixPosition(dbMap, _row3, _row2) // row[3], row[2]の順番に注意

				output := []string{fmt.Sprint(id), fmt.Sprint(age), type1, departure_name, fmt.Sprint(departure_number), fmt.Sprint(departure_lat), fmt.Sprint(departure_lng), arrival_name, fmt.Sprint(arrival_number), fmt.Sprint(arrival_lat), fmt.Sprint(arrival_lng)}

				//output := []string{row[0], row[1], row[2], row[3], row[4]}
				fmt.Println("output:", output)

				if err = w.Write(output); err != nil {
					log.Fatal(err)
				}

				id++ // idの加算
			}
		}

		err = rows1.Err()
		if err != nil {
			panic(err)
		}

		defer w.Flush()

		if err := w.Error(); err != nil {
			log.Fatal(err)
		}

	}
}

// 指定した座標に近いDB上の座標を取得
func fixPosition(db *sql.DB, _x1, _y1 float64) (int, float64, float64) {

	// Scan用の仮変数
	var source int
	var longitude float64
	var latitude float64
	var dist float64

	upperLimitMeter := 1500.0 // 近傍ノードの上限を1500 mに設定
	str := fmt.Sprintf(
		// 修正前: ways (道) の中から最近傍を取得
		// "SELECT source, x1 AS longitude, y1 AS latitude, ST_Distance('SRID=4326;POINT(%v %v)'::GEOGRAPHY, the_geom) AS dist FROM ways WHERE ST_DWithin(the_geom, ST_GeographyFromText('SRID=4326;POINT(%v %v)'), %.1f) ORDER BY dist LIMIT 1",
		// 修正後: ways_vertices_pgr (点座標) の中から最近傍を取得
		"SELECT id AS source, lon AS longitude, lat AS latitude, ST_Distance('SRID=4326;POINT(%v %v)'::GEOGRAPHY, the_geom) AS dist FROM ways_vertices_pgr WHERE ST_DWithin(the_geom, ST_GeographyFromText('SRID=4326;POINT(%v %v)'), %.1f) ORDER BY dist LIMIT 1",
		_x1, _y1, _x1, _y1, upperLimitMeter,
	)
	//fmt.Println(str)

	rows, err := db.Query(str)
	if err != nil {
		log.Fatal(err)
	}
	defer rows.Close()

	foundGoodMapNode := false

	for rows.Next() {
		foundGoodMapNode = true
		if err := rows.Scan(&source, &longitude, &latitude, &dist); err != nil {
			fmt.Println(err)
		}
		//fmt.Println(source, longitude, latitude, dist)
	}

	if !foundGoodMapNode {
		log.Println("Warning: in func fixPosition: Good Map Node not found for query point (",
			_x1, ",", _y1, ")")
	}

	return source, longitude, latitude
}

2023,江端さんの技術メモ

strconv.FormatFloatだの、strconv.FormatIntだの、色々あるけど、

fmt.Sprint(x)  xは、整数でも実数でも可

で十分だと思う。

2023,江端さんの忘備録

今年の下半期からの忙しさは凄かったと思います。

I think I have been very busy since the second half of this year.

それでも、なんとか凌げていたので『なんとかなるもんだなぁ』とか思っていました。

Still, I managed to get by, so I thought, 'I guess I can get by'.

しかし、歯痛→腰痛→風邪による全身疲労が、ここ2週間くらい立て続けで発生し、予定通りに物事が進んでいません。

However, things have not been going as planned due to a series of dental pain, back pain, and general fatigue caused by a cold that has been occurring in rapid succession for the past two weeks.

「パフォーマンスが発揮できない」 → 「予定した仕事が進まない」 → 「焦る」 という段階までは、よくあるのですが、今は、

I have often experienced the "I can't perform" → "I can't get the work done" → "I'm in a hurry" phase. However Now the situation is as follows.

『何か考えようとすると、吐き気がする』

'I get nauseous when I try to think about anything'

という状況です。

こうなると、もう、何もできなくなります

When this happens, there is nothing more that can be done.

こういう状況になって、普段の自分を俯瞰すると、

In situations like this, when I look down on my normal,

―― 私、一体、何のために、毎日あんなに頑張っていたんだっけ?

"What in the world was I working so hard every day for?"

という気持ちになってきます。

This is the feeling I have now

-----

多分、私は、この状態が回復したら、こんなことを忘れたかのように、自分のことや、他人のことを言い始めると思います。

Maybe when I recover from this condition, I will start talking about myself and others as if I have forgotten all this.

しかし、今の『弱っていて、何もできないこの状態の自分がデフォルト』である、ということを覚えておくために、この日記を残しておきます。

However, I leave this diary to remember that I am now 'weak and unable to do anything about this situation', which is my default.

被災して、罹患して、心が壊れて、疲れ果てて、立ち上がることもできない人々に、『がんばれ』とだけ言い放つ人間にだけは決してなるまい、と、再度、自分に言い聞かせるためにも。

To remind myself once again that I will never make me a person who only says, "Hang in there," to people who have been affected by the disaster, who have been afflicted, who are broken, exhausted, and unable to stand up.

今は頑張らなくていいんですよ

 

2023,江端さんの忘備録

■日中、倦怠感でだるさを感じる

- Feels tired throughout the day

■夜中に咳で目がさめる。

- Wake up at night with a cough.

■喉にタンが絡む。タンを切る時に痛みがある

- Phlegm in throat. Pain when cutting phlegm.

■夜寝る前に猛烈な悪寒がある

- Violent chills before going to bed at night.

■夜中にぐっしょりの汗をかく

- Sweating profusely at night

■水は定期的に摂取している。

- Water is consumed regularly.

■市販薬は、「改源」と「コンタックEX」を摂取したが、改善は見られない

- Over-the-counter medications were ingested "Kaigen" and "Contac EX", but no improvement was seen

-----

というメモを作って、本日クリニックに行ってきました。

I went to the clinic today after making the note.

コロナかインフルエンザか、とも思ったのですが、熱が36.6度なので、どっちでもないだろうなと思いました。

I thought it might be corona or influenza, but since my fever was 36.6 degrees, I thought it could be neither.

それでも、発熱者扱いとして、診察室の外で待たされました ―― 窓が開けっぱなしの廊下は寒かったです。

Still, I was treated as a fever patient and made to wait outside the examination room -- it was cold in the hallway with the windows left open.

-----

薬を貰って、早速飲みました。

I got the medicine and took it immediately.

その一時間後ですが、さっきまで指一本動かせない倦怠感の中にいたのですが、、現在は、この文章を書ける状態になっています(まだ、倦怠感はあります)。

An hour later, I was in a state of fatigue where I could not move a finger, but now I am able to write this sentence (I still have the fatigue).

やっぱり処方薬は凄いなぁ、と思いました、

I knew that prescription drugs were great.

2023,江端さんの忘備録

私が自分のブログで、頻繁に、短いプログラムをアップロードしているのは、マニュアル読んだって、APIの使い方が分からないからです。

I frequently upload short programs on my blog because I don't know how to use the API even after reading the manual.

このようなマニュアル読んでもさっぱり分からないし、サンプルプログラムは、私のやりたいこととズレています。

I have no idea what I'm doing by reading these manuals, and the sample programs are out of sync with what I want to do.

ですので、以下のように、

So, as shown in the following

golangによるcsvファイルのライン単位での書き出し方法

実際に、自分で書いて動いたコードを、小まめに残するようにしています。

In reality, I try to keep a small code that I have written and worked with.

他の人の役に立つかどうかは、二の次です。

Whether it is useful to others is secondary.

この方法に名前をつけるとすれば「具体例ベース」というのかもしれません。

If I had to give a name to this method, it might be called "concrete example-based".

それはさておき。

Aside from that.

-----

イベントの招待状などで、『平服にてご参加下さい』という文言が入っていることがありますが ――

In invitations to events, you may see the phrase, "Please attend in plain clothes.

私に言われれば、これは、最低最悪のホスピタリティです。

If you ask me, this is hospitality at its worst.

つまり『礼服はやめてね』と言っているだけで、カジュアルのレベルの判断をゲストに押しつける、無責任極まりない要求であるからです。

In other words, he/she is simply saying, 'Please don't wear formal wear,' and you are forced to judge the level of casual wear. This is an extremely irresponsible request.

ゲスト(招待客)は、カジュアルのレベルを間違えて、会場で恥しい思いをするかもしれません ―― しかし、そういう配慮をするホスト(主催者)には、滅多にお目にかかることができません。

Guests (invitees) may be embarrassed at the venue because of the wrong level of casualness -- but I rarely see a host (organizer) who takes such considerations into account.

-----

先日、父と母の納骨供養の案内を出しました。

I recently sent out information about the event laying their ashes to rest for my father and mother.

江端一夫・瑤子 納骨供養のご案内(公開版)

その中で、私は、ドレスコードを以下のような文章で、正確に規定しました。

In it, I have defined the dress code precisely in the following sentence.

『ご都合がよろしければ、平服にて御気軽にお立ち寄りをご検討頂ければ幸いです』

I hope you will consider stopping by in plain clothes if it is convenient for you.

『(私(智一)は、ジーパンとスニーカーと数珠持参で参加予定です)』

I (Tomoichi) will wear jeans, sneakers and prayer beads.

このように、ホストが、ホスト自身のドレスコードを具体的に提示することで、ゲストの負担を減らすことができます。

In this way, the host can reduce the burden on the guests by providing them with a specific dress code for themselves.

これが、「具体例ベース」です。

It is "concrete example-based".

-----

今後、「平服」を具体例で示さないホストには、このブログのURLをメールで送りつけようと考えています。

In the future, I will email the URL of this blog to hosts who do not provide specific examples of "plain clothes".

2023,江端さんの技術メモ

Keyword: golang csv write 書き出し ライン

package main

import (
	"database/sql"
	"encoding/csv"
	"fmt"
	"log"
	"os"

	_ "github.com/lib/pq"
)

func main() {
	file, err := os.Open("yamaguchi_area.csv")
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()

	r := csv.NewReader(file)
	rows, err := r.ReadAll() // csvを一度に全て読み込む
	if err != nil {
		log.Fatal(err)
	}

	str := "SELECT ST_Covers(st_geomfromtext('POLYGON(("

	// 行ごとに
	for i, row := range rows {
		if i == 0 {
			continue // CSVのヘッダー行を無視
		}

		str += row[1] + " " + row[2] + ", " // rowのままで取り出せば、文字列になっている

	}
	str1 := str[:len(str)-2] + "))'),st_geomfromtext('LINESTRING(" // 上記の最後の", "を削除して、文字列を追加

	dbMap, err := sql.Open("postgres",
		"user=postgres password=password host=192.168.0.23 port=15432 dbname=yama_db sslmode=disable")
	log.Println("------------------ map db open ------------------")
	if err != nil {
		log.Fatal("OpenError: ", err)
	}
	defer dbMap.Close()

	///////////////////////////////////////

	file2, err2 := os.Open("20220518weekday.csv")
	if err2 != nil {
		log.Fatal(err2)
	}
	defer file2.Close()

	r2 := csv.NewReader(file2)
	rows2, err2 := r2.ReadAll() // csvを一度に全て読み込む
	if err != nil {
		log.Fatal(err2)
	}

	file3, err3 := os.Create("testtest.csv")
	if err3 != nil {
		panic(err)
	}
	w := csv.NewWriter(file3)

	for _, row := range rows2 {
		//if i == 0 {
		//	continue // CSVのヘッダー行を無視
		//}

		str2 := str1 + row[0] + " " + row[1] + ", " + row[2] + " " + row[3]

		str2 += ")'))"

		//fmt.Println(str2)

		rows1, err := dbMap.Query(str2)
		if err != nil {
			log.Fatal(err)
		}
		defer rows1.Close()

		//var dt string
		var dt bool

		for rows1.Next() {
			if err := rows1.Scan(&dt); err != nil {
				fmt.Println(err)
			}
			// fmt.Println(dt)
			if dt {
				output := []string{row[0], row[1], row[2], row[3], row[4]}
				//fmt.Println("output:", output)

				if err = w.Write(output); err != nil {
					log.Fatal(err)
				}
			}
		}

		err = rows1.Err()
		if err != nil {
			panic(err)
		}

		defer w.Flush()

		if err := w.Error(); err != nil {
			log.Fatal(err)
		}

	}
}

重要なのは、以下のコード

file3, err3 := os.Create("testtest.csv")
if err3 != nil {
panic(err)
}

w := csv.NewWriter(file3)

output := []string{row[0], row[1], row[2], row[3], row[4]}
//fmt.Println("output:", output)

if err = w.Write(output); err != nil {
log.Fatal(err)
}

defer w.Flush()