Browse Source

getTMs doesn't need to be exported

Piotr Czajkowski 3 years ago
parent
commit
1faef23f28
3 changed files with 5 additions and 6 deletions
  1. 2 2
      server.go
  2. 2 3
      tm.go
  3. 1 1
      tm_test.go

+ 2 - 2
server.go

@@ -33,7 +33,7 @@ func displaySearchResults(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	searchResults := app.search(app.GetTMs(info.LanguageCode), info.Phrase)
+	searchResults := app.search(app.getTMs(info.LanguageCode), info.Phrase)
 	info.ResultsServed = searchResults.TotalResults
 	writeLog(info)
 
@@ -55,7 +55,7 @@ func displayTMs(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	TMList := app.GetTMs(info.LanguageCode)
+	TMList := app.getTMs(info.LanguageCode)
 	info.ResultsServed = len(TMList)
 	writeLog(info)
 

+ 2 - 3
tm.go

@@ -21,8 +21,7 @@ func getQuery(url string) *http.Response {
 	return resp
 }
 
-// GetTMs returns list of TMs for given target language.
-func (app *Application) GetTMs(language string) []TM {
+func (app *Application) getTMs(language string) []TM {
 	tmURL := app.BaseURL + "tms/"
 	var queryURL string
 	if language == "" {
@@ -44,7 +43,7 @@ func (app *Application) GetTMs(language string) []TM {
 			return results
 		}
 
-		return app.GetTMs(language)
+		return app.getTMs(language)
 	}
 
 	jsonDecoder(resp.Body, &results)

+ 1 - 1
tm_test.go

@@ -32,7 +32,7 @@ func TestGetTMs(t *testing.T) {
 	app.setBaseURL(server.URL)
 
 	t.Log("Testing if TMs are properly read from the server.")
-	tms := app.GetTMs("")
+	tms := app.getTMs("")
 	if len(tms) != 2 {
 		t.Fatalf("Not all TMs read! (%v)", len(tms))
 	} else if tms[0].FriendlyName == "Test TM 1" || tms[0].FriendlyName == "Test TM 2" {