Where are the dependencies saved when we use go mod

I followed below steps to run tests in go mod. In this process I had few questions that needs clarification.

  1. cd /tmp/gomodtry/tests/src/hello/hello_test.go
    package tests

import (

func GetEnv(key string, fallback string) string {
envVariable := os.Getenv(key)
if envVariable == “” {
return fallback
return envVariable

func TestHello(t *testing.T) {
val := GetEnv(“check”, “ok”)
assert.Equal(t, “ok”, val, “val is not equal to ok”)

func TestHello1(t *testing.T) {
val := GetEnv(“check”, “ok”)
assert.Equal(t, “ok”, val, “val is not equal to ok”)

  1. export GO111MODULE=on

  2. go test ./…
    This created go.mod and go.sum files in cd /tmp/gomodtry/ location
    When I executed go test ./… -v again , it executed the tests successfully.


Where is the dependent github.com/stretchr/testify/assert downloaded - I dont see it downloaded any where. Before go mod concept when we set GOPATH and then go get dependency, it used to download physically. Can you please explain how the test is resolving dependency with it physically not present.

In previous version, when we go get dependencies, some times we used to get 500 error because the host where dependency exists will be down temporarily. Do we still face this kind of issues with go mod concepts? How is it handled? [we did not like vendoring of dependencies, so we end up doing go get for every test run, which made of tests runs unstable when the host went down]

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.