Saltar al contenido principal
ProductosHerramientas de escritorioTASTECADRevisión de planosTASTEFILESGestión de archivosTASTEFTPTransferencia de archivosTASTESSHEspacio de trabajo remotoTASTEZIPCompresión y extracciónTASTEWINMGestión de archivosHerramientas para desarrolladoresTASTECODEEntorno de desarrollo integrado para RustTASTESTUDIOEntorno integrado de desarrollo y pruebasTASTEETLIntegración de datos (ETL)ServidoresTASTEREMOTEServidor de escritorio remotoTASTEGEOServidor geoespacialTASTEMAILEspacio de trabajo de correoInversiónTASTESTOCKAplicación de escritorio de trading automático de accionesEmpezarDescargasDocumentaciónComprarTodos los productos
Marketplace
Noticias
TecnologíaNoticiasNoticias de desarrollo de hoyDocumentaciónLenguajes de programaciónRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks web frontendNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks de apps y escritorioTauriFlutterReact NativeElectronAlgoritmosFundamentos de algoritmosAlgoritmos esencialesAlgoritmos avanzadosAlgoritmos prácticos
ComunidadProyectosRegistros de desarrolloPromptsProblemas con herramientas de IAEscaparateGuía de la comunidad
ColaboraTransferencia técnicaDesarrollo de sitio webDesarrollo de app de escritorioCanal de lanzamiento y pagosSocio de ventasContacto
ServiciosEscritorio remotoPaquetes de instalación a medida
TASTEDEV
Productos

Herramientas de escritorio

TASTECADAbre planos complejos con ligerezaTASTEFILESSolo los archivos que necesitas, lo más rápido posibleTASTEFTPEl camino más limpio para tus archivosTASTESSHEntre tu servidor y tú, una conexión más sólidaTASTEZIPComprime más rápido, descomprime más seguroTASTEWINMUn gestor de archivos de dos paneles pensado para el teclado

Herramientas para desarrolladores

TASTECODEEdita, compila, depura y prueba apps de Rust en una sola ventanaTASTESTUDIODe la edición a las pruebas remotas y las correcciones con IA aprobadasTASTEETLMueve datos viendo sus valores

Servidores

TASTEREMOTEUn escritorio remoto que funciona en tu propio servidorTASTEGEOUn servidor geoespacial compatible con GeoServer, reconstruido en RustTASTEMAILRecupera el control de tu correo

Inversión

TASTESTOCKTrading automático de acciones según las reglas que tú defines: cuándo y qué

Empezar

DescargasÚltimas versiones de cada productoDocsCómo usar cada productoComprarSuscripciones y licencias perpetuasTodos los productosTodos los productos de un vistazo
Todos los productos
MarketplaceNoticias
Tecnología

Noticias

Noticias de desarrollo de hoyAnuncios oficiales de lenguajes, frameworks, GitHub e IADocumentaciónGuías de lenguajes, frameworks y algoritmos

Lenguajes de programación

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks web frontendNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks de apps y escritorioTauriFlutterReact NativeElectron

Algoritmos

Fundamentos de algoritmosAnálisis de complejidad · Ordenamiento · Búsqueda · Estructuras de datos básicas · Árboles y montículosAlgoritmos esencialesRecorrido de grafos · Camino mínimo y árbol generador mínimo · Programación dinámica · Algoritmos voraces · Divide y vencerás · Backtracking (vuelta atrás)Algoritmos avanzadosAlgoritmos de cadenas · Matemáticas y teoría de números · Manipulación de bits · Árboles de segmentos · Union-FindAlgoritmos prácticosEstrategia para entrevistas de código · Caché LRU · Limitación de tasa · Hashing consistente
Toda la documentación de desarrollo
Comunidad
ProyectosDescubre creadores y su trabajoRegistros de desarrolloDecisiones y aprendizajesPromptsInstrucciones reutilizablesProblemas con herramientas de IAProblemas y alternativas de Claude, Codex, GeminiEscaparateResultados terminadosGuía de la comunidadCómo construimos en abierto
Colabora
Transferencia técnicaApps nativas con Rust y eguiDesarrollo de sitio web10 idiomas, cuentas, documentación y descargasDesarrollo de app de escritorioRust y egui, sin WebViewCanal de lanzamiento y pagosFirma, MSI, deb, rpm, AppImage, hashesSocio de ventasRecomiéndanos y gana el 30 %ContactoDesarrollo, alianzas e inversión
Servicios
Escritorio remotoAccede a tu ordenador desde el navegadorPaquetes de instalación a medidaSolo lo necesario, ajustes precargados
Comprar
ES
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Iniciar sesión
Iniciar sesión
TASTEDEV

De pequeñas herramientas a un mejor desarrollo.

support@tastedev.netApoyar a TASTEDEV
ProductosLínea de productosComprarDocsDescargasMarketplaceSoporte
ComunidadProyectosRegistros de desarrolloPromptsProblemas con herramientas de IAEscaparate
PolíticasQuiénes somosPolítica de privacidadTérminos de servicioCondiciones de suscripciónReembolsosNormas de la comunidad
CuentaIniciar sesiónRegistrarse
Visitantes
Hoy
Ayer
Vistas totales
Empresa
GXSOFT
Representante
CHOI YOUNG GU
Número de registro mercantil
853-44-00368
Dirección
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Teléfono
+82-10-4404-1523
Correo electrónico
whitecalvin@tastedev.net
Responsable de privacidad
CHOI YOUNG GU

© 2026 TASTEDEVLa información de los productos se basa en fuentes de desarrollo verificadas.Publicado · en mejora

Documentación de Go
Go
Getting Started with GoSyntax BasicsTypes and DataModules and PackagesErrors and TestingKey Concepts: Concurrency
Debates

Guía de Go · 3/6

Types and Data

Por ahora, este capítulo solo está disponible en inglés.

Go is statically typed, but type inference keeps it from feeling verbose. This chapter tours the data building blocks of every Go program.

Basic types

KindTypes
Booleanbool
Integersint, int8 to int64, uint, uint8 to uint64
Floating point and complexfloat32, float64, complex64, complex128
Stringsstring (an immutable sequence of UTF-8 bytes)
Aliasesbyte (same as uint8), rune (same as int32, a Unicode code point)

Go never converts between numeric types implicitly. To add an int to a float64 you write float64(n) explicitly. Strings are bytes under the hood, but ranging over a string decodes it into runes, which is what you want for text.

n := 3
f := 1.5
total := float64(n) + f

s := "héllo"
fmt.Println(len(s))            // 6: length in bytes, not characters
for i, r := range s {
	fmt.Println(i, string(r)) // the é occupies bytes 1 and 2
}

Arrays and slices

An array has a fixed length that is part of its type, so [3]int and [4]int are different types. In practice you will reach for slices far more often. A slice is a lightweight view onto an underlying array, with a length (len) and a capacity (cap). When append runs out of capacity it allocates a bigger array, which is why you must always assign its result back.

arr := [3]int{1, 2, 3}      // array
nums := []int{1, 2, 3}      // slice
nums = append(nums, 4, 5)

part := nums[1:3]           // [2 3], shares memory with nums
part[0] = 20                // nums[1] is now 20 as well

buf := make([]byte, 0, 64)  // length 0, capacity 64
copied := make([]int, len(nums))
copy(copied, nums)          // an independent copy
fmt.Println(arr, nums, len(buf), cap(buf), copied)

Because sub-slices share storage with the original, use copy or slices.Clone when you need an independent value. The standard slices package also provides everyday helpers such as slices.Sort, slices.Contains, and slices.Index.

Maps

A map is a built-in hash table. Reading a missing key returns the zero value of the value type, so when presence matters, use the two-value form and check the second result, conventionally named . Iteration order over a map is deliberately unspecified.

¿Tienes preguntas sobre este capítulo?
Capítulo anteriorSyntax BasicsCapítulo siguienteModules and Packages
ok
ages := map[string]int{"alice": 31, "bob": 27}
ages["carol"] = 40

if age, ok := ages["dave"]; !ok {
	fmt.Println("no dave", age) // age is 0
}

delete(ages, "bob")
for name, age := range ages {
	fmt.Println(name, age)
}

counts := make(map[string]int)
counts["go"]++ // missing keys start at zero, so counting just works

A nil map can be read from but panics on write, so create maps with a literal or with make.

Structs and methods

A struct groups named fields. Go has no classes; instead you attach methods to types. A method is simply a function with a receiver. Use a pointer receiver (*T) when the method mutates the value or the struct is large, and a value receiver for small read-only types. Within a single type, try to stick to one kind of receiver.

type Point struct {
	X, Y float64
}

func (p Point) Dist() float64 { // value receiver: works on a copy
	return math.Hypot(p.X, p.Y)
}

func (p *Point) Scale(k float64) { // pointer receiver: mutates the original
	p.X *= k
	p.Y *= k
}

type Named struct {
	Point        // embedded: Point's fields and methods are promoted
	Name  string
}

func main() {
	p := Point{X: 3, Y: 4}
	p.Scale(2) // Go takes &p for you
	n := Named{Point: p, Name: "A"}
	fmt.Println(p.Dist(), n.X, n.Dist())
}

Instead of inheritance, Go offers embedding: placing one type inside another promotes its fields and methods.

Interfaces

An interface is a set of method signatures. There is no implements keyword: any type that has the right methods satisfies the interface automatically. As a result, interfaces tend to be small and defined by the code that uses them.

type Shape interface {
	Area() float64
}

type Rect struct{ W, H float64 }
type Circle struct{ R float64 }

func (r Rect) Area() float64   { return r.W * r.H }
func (c Circle) Area() float64 { return math.Pi * c.R * c.R }

func describe(v any) string {
	switch x := v.(type) { // type switch
	case Shape:
		return fmt.Sprintf("area %.2f", x.Area())
	case string:
		return "a string: " + x
	default:
		return "unknown"
	}
}

func main() {
	shapes := []Shape{Rect{2, 3}, Circle{1}}
	for _, s := range shapes {
		fmt.Println(describe(s))
	}
}

any is an alias for the empty interface interface{} and can hold a value of any type. To get the concrete value back out, use a type assertion v.(T) or a type switch. Go also supports generics through type parameters, so an algorithm that works over many types can be written once, for example func Max[T cmp.Ordered](a, b T) T.

Pointers

A pointer holds the address of a value: &x takes the address, and *p reads or writes through it. There is no pointer arithmetic, and memory is garbage collected, so returning the address of a local variable is perfectly safe.

func newCounter() *int {
	c := 0
	return &c // safe: c escapes to the heap
}

func main() {
	p := newCounter()
	*p++
	fmt.Println(*p) // 1

	pt := &Point{1, 2}
	pt.X = 10 // no need to write (*pt).X
}

Go always passes arguments by value. Reach for a pointer when a function must modify its argument or when copying a large struct would be wasteful. Slices and maps already contain references internally, so copying one still points at the same underlying data.

Summary

  • Conversions are always explicit; strings are UTF-8 bytes and range yields runes.
  • Slices are views onto arrays; always reassign the result of append.
  • Check map membership with v, ok := m[k].
  • Attach methods to structs and compose with embedding instead of inheriting.
  • Interfaces are satisfied implicitly, and pointers let functions share and mutate data.

0 comentarios

Comentarios destacadosMás recientes primero

Iniciar sesión · Inicia sesión para dejar un comentario.