<commit_before>package main

import (
	"crypto/rand"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"os"
	"strconv"
	"strings"
)

type User struct {
	Id    int
	Name  string
	Token string
}

const (
	MAX_CHAN = 10000
)

type AppConfig struct {
	msgc chan Message
}

type Message struct {
	Content       string
	UserIdSend    int
	UserIdReceive int
}

type ErrMessage struct {
	Err string
}

type AppHandler struct {
	appConfig AppConfig
	h         func(app AppConfig, w http.ResponseWriter, r *http.Request) (int, error)
}

func (app AppConfig) findChan(uid int) chan Message {
	// todo this is a adapter sub
	return app.msgc
}

func addmsg(a Message, c chan Message) {
	fmt.Println("===>msg len in go")

	// todo this is a adapter sub
	c <- a
	fmt.Println("===>msg len in go", len(c))

}

func validateToken(token string) bool {
	return true
}

func (app AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {<commit_msg>fixed the missing msg for receive<commit_after>package main

import (
	"crypto/rand"
	"encoding/base64"
	"encoding/json"
	"errors"
	"fmt"
	"html/template"
	"log"
	"net/http"
	"os"
	"strconv"
	"strings"
)

type User struct {
	Id    int
	Name  string
	Token string
}

const (
	MAX_CHAN = 10000
)

type AppConfig struct {
	msgc chan Message
}

type Message struct {
	Content       string
	UserIdSend    int
	UserIdReceive int
}

type ErrMessage struct {
	Err string
}

type AppHandler struct {
	appConfig AppConfig
	h         func(app AppConfig, w http.ResponseWriter, r *http.Request) (int, error)
}

func (app AppConfig) findChan(uid int) chan Message {
	// todo this is a adapter sub
	return app.msgc
}

func addmsg(a Message, c chan Message) {
	// todo this is a adapter sub
	c <- a
}

func validateToken(token string) bool {
	return true
}

func (app AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
{'fraction_non_alphanumeric': 0.10211640211640212, 'fraction_numerical': 0.007407407407407408, 'mean_word_length': 3.491686460807601, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4347154', 'n_tokens_mistral': 702, 'n_tokens_neox': 680, 'n_words': 218}