// Changing user is a little tough, but the group can be changed by a limited user to any group that the user is a member of. So just choose one that is not the current main group.
u,err:=user.Current()
iferr!=nil{
t.Fatal(err)
}
ugroups,err:=u.GroupIds()
iferr!=nil{
t.Fatal(err)
}
for_,ugroup:=rangeugroups{
ifugroup==u.Gid{
continue
}
gid,err:=strconv.Atoi(ugroup)
iferr!=nil{
t.Fatal(ugroup)
}
iferr:=os.Lchown(tmpfn,-1,gid);err!=nil{
t.Fatal(err)
}
}
// Check for sanity. This ought to have failures
res,err:=Check(dir,dh,nil,nil)
iferr!=nil{
t.Fatal(err)
}
iflen(res)==0{
t.Error("expected failures (like mtimes), but got none")