Best Gauge code snippet using config.Len
key_agreement.go
Source:key_agreement.go
...60 if err != nil {61 return nil, errors.New("failed to sign RSA parameters: " + err.Error())62 }63 skx := new(serverKeyExchangeMsg)64 sigAlgsLen := 065 if ka.version >= VersionTLS12 {66 sigAlgsLen = 267 }68 skx.key = make([]byte, len(serverRSAParams)+sigAlgsLen+2+len(sig))69 copy(skx.key, serverRSAParams)70 k := skx.key[len(serverRSAParams):]71 if ka.version >= VersionTLS12 {72 k[0] = byte(sigAlg >> 8)73 k[1] = byte(sigAlg)74 k = k[2:]75 }76 k[0] = byte(len(sig) >> 8)77 k[1] = byte(len(sig))78 copy(k[2:], sig)79 return skx, nil80}81func (ka *rsaKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) {82 preMasterSecret := make([]byte, 48)83 _, err := io.ReadFull(config.rand(), preMasterSecret[2:])84 if err != nil {85 return nil, err86 }87 if len(ckx.ciphertext) < 2 {88 return nil, errClientKeyExchange89 }90 ciphertext := ckx.ciphertext91 if version != VersionSSL30 {92 ciphertextLen := int(ckx.ciphertext[0])<<8 | int(ckx.ciphertext[1])93 if ciphertextLen != len(ckx.ciphertext)-2 {94 return nil, errClientKeyExchange95 }96 ciphertext = ckx.ciphertext[2:]97 }98 key := cert.PrivateKey.(*rsa.PrivateKey)99 if ka.exportKey != nil {100 key = ka.exportKey101 }102 err = rsa.DecryptPKCS1v15SessionKey(config.rand(), key, ciphertext, preMasterSecret)103 if err != nil {104 return nil, err105 }106 // This check should be done in constant-time, but this is a testing107 // implementation. See the discussion at the end of section 7.4.7.1 of108 // RFC 4346.109 vers := uint16(preMasterSecret[0])<<8 | uint16(preMasterSecret[1])110 if ka.clientVersion != vers {111 return nil, fmt.Errorf("tls: invalid version in RSA premaster (got %04x, wanted %04x)", vers, ka.clientVersion)112 }113 return preMasterSecret, nil114}115func (ka *rsaKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error {116 return errors.New("tls: unexpected ServerKeyExchange")117}118func (ka *rsaKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) {119 bad := config.Bugs.BadRSAClientKeyExchange120 preMasterSecret := make([]byte, 48)121 vers := clientHello.vers122 if bad == RSABadValueWrongVersion {123 vers ^= 1124 }125 preMasterSecret[0] = byte(vers >> 8)126 preMasterSecret[1] = byte(vers)127 _, err := io.ReadFull(config.rand(), preMasterSecret[2:])128 if err != nil {129 return nil, nil, err130 }131 sentPreMasterSecret := preMasterSecret132 if bad == RSABadValueTooLong {133 sentPreMasterSecret = make([]byte, len(sentPreMasterSecret)+1)134 copy(sentPreMasterSecret, preMasterSecret)135 } else if bad == RSABadValueTooShort {136 sentPreMasterSecret = sentPreMasterSecret[:len(sentPreMasterSecret)-1]137 }138 encrypted, err := rsa.EncryptPKCS1v15(config.rand(), cert.PublicKey.(*rsa.PublicKey), sentPreMasterSecret)139 if err != nil {140 return nil, nil, err141 }142 if bad == RSABadValueCorrupt {143 encrypted[len(encrypted)-1] ^= 1144 // Clear the high byte to ensure |encrypted| is still below the RSA modulus.145 encrypted[0] = 0146 }147 ckx := new(clientKeyExchangeMsg)148 if ka.version != VersionSSL30 {149 ckx.ciphertext = make([]byte, len(encrypted)+2)150 ckx.ciphertext[0] = byte(len(encrypted) >> 8)151 ckx.ciphertext[1] = byte(len(encrypted))152 copy(ckx.ciphertext[2:], encrypted)153 } else {154 ckx.ciphertext = encrypted155 }156 return preMasterSecret, ckx, nil157}158func (ka *rsaKeyAgreement) peerSignatureAlgorithm() signatureAlgorithm {159 return 0160}161// A ecdhCurve is an instance of ECDH-style key agreement for TLS.162type ecdhCurve interface {163 // offer generates a keypair using rand. It returns the encoded |publicKey|.164 offer(rand io.Reader) (publicKey []byte, err error)165 // accept responds to the |peerKey| generated by |offer| with the acceptor's166 // |publicKey|, and returns agreed-upon |preMasterSecret| to the acceptor.167 accept(rand io.Reader, peerKey []byte) (publicKey []byte, preMasterSecret []byte, err error)168 // finish returns the computed |preMasterSecret|, given the |peerKey|169 // generated by |accept|.170 finish(peerKey []byte) (preMasterSecret []byte, err error)171}172// ellipticECDHCurve implements ecdhCurve with an elliptic.Curve.173type ellipticECDHCurve struct {174 curve elliptic.Curve175 privateKey []byte176}177func (e *ellipticECDHCurve) offer(rand io.Reader) (publicKey []byte, err error) {178 var x, y *big.Int179 e.privateKey, x, y, err = elliptic.GenerateKey(e.curve, rand)180 if err != nil {181 return nil, err182 }183 return elliptic.Marshal(e.curve, x, y), nil184}185func (e *ellipticECDHCurve) accept(rand io.Reader, peerKey []byte) (publicKey []byte, preMasterSecret []byte, err error) {186 publicKey, err = e.offer(rand)187 if err != nil {188 return nil, nil, err189 }190 preMasterSecret, err = e.finish(peerKey)191 if err != nil {192 return nil, nil, err193 }194 return195}196func (e *ellipticECDHCurve) finish(peerKey []byte) (preMasterSecret []byte, err error) {197 x, y := elliptic.Unmarshal(e.curve, peerKey)198 if x == nil {199 return nil, errors.New("tls: invalid peer key")200 }201 x, _ = e.curve.ScalarMult(x, y, e.privateKey)202 preMasterSecret = make([]byte, (e.curve.Params().BitSize+7)>>3)203 xBytes := x.Bytes()204 copy(preMasterSecret[len(preMasterSecret)-len(xBytes):], xBytes)205 return preMasterSecret, nil206}207// x25519ECDHCurve implements ecdhCurve with X25519.208type x25519ECDHCurve struct {209 privateKey [32]byte210}211func (e *x25519ECDHCurve) offer(rand io.Reader) (publicKey []byte, err error) {212 _, err = io.ReadFull(rand, e.privateKey[:])213 if err != nil {214 return215 }216 var out [32]byte217 curve25519.ScalarBaseMult(&out, &e.privateKey)218 return out[:], nil219}220func (e *x25519ECDHCurve) accept(rand io.Reader, peerKey []byte) (publicKey []byte, preMasterSecret []byte, err error) {221 publicKey, err = e.offer(rand)222 if err != nil {223 return nil, nil, err224 }225 preMasterSecret, err = e.finish(peerKey)226 if err != nil {227 return nil, nil, err228 }229 return230}231func (e *x25519ECDHCurve) finish(peerKey []byte) (preMasterSecret []byte, err error) {232 if len(peerKey) != 32 {233 return nil, errors.New("tls: invalid peer key")234 }235 var out, peerKeyCopy [32]byte236 copy(peerKeyCopy[:], peerKey)237 curve25519.ScalarMult(&out, &e.privateKey, &peerKeyCopy)238 // Per RFC 7748, reject the all-zero value in constant time.239 var zeros [32]byte240 if subtle.ConstantTimeCompare(zeros[:], out[:]) == 1 {241 return nil, errors.New("tls: X25519 value with wrong order")242 }243 return out[:], nil244}245func curveForCurveID(id CurveID) (ecdhCurve, bool) {246 switch id {247 case CurveP224:248 return &ellipticECDHCurve{curve: elliptic.P224()}, true249 case CurveP256:250 return &ellipticECDHCurve{curve: elliptic.P256()}, true251 case CurveP384:252 return &ellipticECDHCurve{curve: elliptic.P384()}, true253 case CurveP521:254 return &ellipticECDHCurve{curve: elliptic.P521()}, true255 case CurveX25519:256 return &x25519ECDHCurve{}, true257 default:258 return nil, false259 }260}261// keyAgreementAuthentication is a helper interface that specifies how262// to authenticate the ServerKeyExchange parameters.263type keyAgreementAuthentication interface {264 signParameters(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg, params []byte) (*serverKeyExchangeMsg, error)265 verifyParameters(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, params []byte, sig []byte) error266}267// nilKeyAgreementAuthentication does not authenticate the key268// agreement parameters.269type nilKeyAgreementAuthentication struct{}270func (ka *nilKeyAgreementAuthentication) signParameters(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg, params []byte) (*serverKeyExchangeMsg, error) {271 skx := new(serverKeyExchangeMsg)272 skx.key = params273 return skx, nil274}275func (ka *nilKeyAgreementAuthentication) verifyParameters(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, params []byte, sig []byte) error {276 return nil277}278// signedKeyAgreement signs the ServerKeyExchange parameters with the279// server's private key.280type signedKeyAgreement struct {281 keyType keyType282 version uint16283 peerSignatureAlgorithm signatureAlgorithm284}285func (ka *signedKeyAgreement) signParameters(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg, params []byte) (*serverKeyExchangeMsg, error) {286 // The message to be signed is prepended by the randoms.287 var msg []byte288 msg = append(msg, clientHello.random...)289 msg = append(msg, hello.random...)290 msg = append(msg, params...)291 var sigAlg signatureAlgorithm292 var err error293 if ka.version >= VersionTLS12 {294 sigAlg, err = selectSignatureAlgorithm(ka.version, cert.PrivateKey, config, clientHello.signatureAlgorithms)295 if err != nil {296 return nil, err297 }298 }299 sig, err := signMessage(ka.version, cert.PrivateKey, config, sigAlg, msg)300 if err != nil {301 return nil, err302 }303 if config.Bugs.SendSignatureAlgorithm != 0 {304 sigAlg = config.Bugs.SendSignatureAlgorithm305 }306 skx := new(serverKeyExchangeMsg)307 if config.Bugs.UnauthenticatedECDH {308 skx.key = params309 } else {310 sigAlgsLen := 0311 if ka.version >= VersionTLS12 {312 sigAlgsLen = 2313 }314 skx.key = make([]byte, len(params)+sigAlgsLen+2+len(sig))315 copy(skx.key, params)316 k := skx.key[len(params):]317 if ka.version >= VersionTLS12 {318 k[0] = byte(sigAlg >> 8)319 k[1] = byte(sigAlg)320 k = k[2:]321 }322 k[0] = byte(len(sig) >> 8)323 k[1] = byte(len(sig))324 copy(k[2:], sig)325 }326 return skx, nil327}328func (ka *signedKeyAgreement) verifyParameters(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, params []byte, sig []byte) error {329 // The peer's key must match the cipher type.330 publicKey := getCertificatePublicKey(cert)331 switch ka.keyType {332 case keyTypeECDSA:333 _, edsaOk := publicKey.(*ecdsa.PublicKey)334 _, ed25519Ok := publicKey.(ed25519.PublicKey)335 if !edsaOk && !ed25519Ok {336 return errors.New("tls: ECDHE ECDSA requires a ECDSA or Ed25519 server public key")337 }338 case keyTypeRSA:339 _, ok := publicKey.(*rsa.PublicKey)340 if !ok {341 return errors.New("tls: ECDHE RSA requires a RSA server public key")342 }343 default:344 return errors.New("tls: unknown key type")345 }346 // The message to be signed is prepended by the randoms.347 var msg []byte348 msg = append(msg, clientHello.random...)349 msg = append(msg, serverHello.random...)350 msg = append(msg, params...)351 var sigAlg signatureAlgorithm352 if ka.version >= VersionTLS12 {353 if len(sig) < 2 {354 return errServerKeyExchange355 }356 sigAlg = signatureAlgorithm(sig[0])<<8 | signatureAlgorithm(sig[1])357 sig = sig[2:]358 // Stash the signature algorithm to be extracted by the handshake.359 ka.peerSignatureAlgorithm = sigAlg360 }361 if len(sig) < 2 {362 return errServerKeyExchange363 }364 sigLen := int(sig[0])<<8 | int(sig[1])365 if sigLen+2 != len(sig) {366 return errServerKeyExchange367 }368 sig = sig[2:]369 return verifyMessage(ka.version, publicKey, config, sigAlg, msg, sig)370}371// ecdheKeyAgreement implements a TLS key agreement where the server372// generates a ephemeral EC public/private key pair and signs it. The373// pre-master secret is then calculated using ECDH. The signature may374// either be ECDSA or RSA.375type ecdheKeyAgreement struct {376 auth keyAgreementAuthentication377 curve ecdhCurve378 curveID CurveID379 peerKey []byte380}381func (ka *ecdheKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) {382 var curveid CurveID383 preferredCurves := config.curvePreferences()384NextCandidate:385 for _, candidate := range preferredCurves {386 for _, c := range clientHello.supportedCurves {387 if candidate == c {388 curveid = c389 break NextCandidate390 }391 }392 }393 if curveid == 0 {394 return nil, errors.New("tls: no supported elliptic curves offered")395 }396 var ok bool397 if ka.curve, ok = curveForCurveID(curveid); !ok {398 return nil, errors.New("tls: preferredCurves includes unsupported curve")399 }400 ka.curveID = curveid401 publicKey, err := ka.curve.offer(config.rand())402 if err != nil {403 return nil, err404 }405 // http://tools.ietf.org/html/rfc4492#section-5.4406 serverECDHParams := make([]byte, 1+2+1+len(publicKey))407 serverECDHParams[0] = 3 // named curve408 if config.Bugs.SendCurve != 0 {409 curveid = config.Bugs.SendCurve410 }411 serverECDHParams[1] = byte(curveid >> 8)412 serverECDHParams[2] = byte(curveid)413 serverECDHParams[3] = byte(len(publicKey))414 copy(serverECDHParams[4:], publicKey)415 if config.Bugs.InvalidECDHPoint {416 serverECDHParams[4] ^= 0xff417 }418 return ka.auth.signParameters(config, cert, clientHello, hello, serverECDHParams)419}420func (ka *ecdheKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) {421 if len(ckx.ciphertext) == 0 || int(ckx.ciphertext[0]) != len(ckx.ciphertext)-1 {422 return nil, errClientKeyExchange423 }424 return ka.curve.finish(ckx.ciphertext[1:])425}426func (ka *ecdheKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error {427 if len(skx.key) < 4 {428 return errServerKeyExchange429 }430 if skx.key[0] != 3 { // named curve431 return errors.New("tls: server selected unsupported curve")432 }433 curveid := CurveID(skx.key[1])<<8 | CurveID(skx.key[2])434 ka.curveID = curveid435 var ok bool436 if ka.curve, ok = curveForCurveID(curveid); !ok {437 return errors.New("tls: server selected unsupported curve")438 }439 publicLen := int(skx.key[3])440 if publicLen+4 > len(skx.key) {441 return errServerKeyExchange442 }443 // Save the peer key for later.444 ka.peerKey = skx.key[4 : 4+publicLen]445 // Check the signature.446 serverECDHParams := skx.key[:4+publicLen]447 sig := skx.key[4+publicLen:]448 return ka.auth.verifyParameters(config, clientHello, serverHello, cert, serverECDHParams, sig)449}450func (ka *ecdheKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) {451 if ka.curve == nil {452 return nil, nil, errors.New("missing ServerKeyExchange message")453 }454 publicKey, preMasterSecret, err := ka.curve.accept(config.rand(), ka.peerKey)455 if err != nil {456 return nil, nil, err457 }458 ckx := new(clientKeyExchangeMsg)459 ckx.ciphertext = make([]byte, 1+len(publicKey))460 ckx.ciphertext[0] = byte(len(publicKey))461 copy(ckx.ciphertext[1:], publicKey)462 if config.Bugs.InvalidECDHPoint {463 ckx.ciphertext[1] ^= 0xff464 }465 return preMasterSecret, ckx, nil466}467func (ka *ecdheKeyAgreement) peerSignatureAlgorithm() signatureAlgorithm {468 if auth, ok := ka.auth.(*signedKeyAgreement); ok {469 return auth.peerSignatureAlgorithm470 }471 return 0472}473// nilKeyAgreement is a fake key agreement used to implement the plain PSK key474// exchange.475type nilKeyAgreement struct{}476func (ka *nilKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) {477 return nil, nil478}479func (ka *nilKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) {480 if len(ckx.ciphertext) != 0 {481 return nil, errClientKeyExchange482 }483 // Although in plain PSK, otherSecret is all zeros, the base key484 // agreement does not access to the length of the pre-shared485 // key. pskKeyAgreement instead interprets nil to mean to use all zeros486 // of the appropriate length.487 return nil, nil488}489func (ka *nilKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error {490 if len(skx.key) != 0 {491 return errServerKeyExchange492 }493 return nil494}495func (ka *nilKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) {496 // Although in plain PSK, otherSecret is all zeros, the base key497 // agreement does not access to the length of the pre-shared498 // key. pskKeyAgreement instead interprets nil to mean to use all zeros499 // of the appropriate length.500 return nil, &clientKeyExchangeMsg{}, nil501}502func (ka *nilKeyAgreement) peerSignatureAlgorithm() signatureAlgorithm {503 return 0504}505// makePSKPremaster formats a PSK pre-master secret based on otherSecret from506// the base key exchange and psk.507func makePSKPremaster(otherSecret, psk []byte) []byte {508 out := make([]byte, 0, 2+len(otherSecret)+2+len(psk))509 out = append(out, byte(len(otherSecret)>>8), byte(len(otherSecret)))510 out = append(out, otherSecret...)511 out = append(out, byte(len(psk)>>8), byte(len(psk)))512 out = append(out, psk...)513 return out514}515// pskKeyAgreement implements the PSK key agreement.516type pskKeyAgreement struct {517 base keyAgreement518 identityHint string519}520func (ka *pskKeyAgreement) generateServerKeyExchange(config *Config, cert *Certificate, clientHello *clientHelloMsg, hello *serverHelloMsg) (*serverKeyExchangeMsg, error) {521 // Assemble the identity hint.522 bytes := make([]byte, 2+len(config.PreSharedKeyIdentity))523 bytes[0] = byte(len(config.PreSharedKeyIdentity) >> 8)524 bytes[1] = byte(len(config.PreSharedKeyIdentity))525 copy(bytes[2:], []byte(config.PreSharedKeyIdentity))526 // If there is one, append the base key agreement's527 // ServerKeyExchange.528 baseSkx, err := ka.base.generateServerKeyExchange(config, cert, clientHello, hello)529 if err != nil {530 return nil, err531 }532 if baseSkx != nil {533 bytes = append(bytes, baseSkx.key...)534 } else if config.PreSharedKeyIdentity == "" && !config.Bugs.AlwaysSendPreSharedKeyIdentityHint {535 // ServerKeyExchange is optional if the identity hint is empty536 // and there would otherwise be no ServerKeyExchange.537 return nil, nil538 }539 skx := new(serverKeyExchangeMsg)540 skx.key = bytes541 return skx, nil542}543func (ka *pskKeyAgreement) processClientKeyExchange(config *Config, cert *Certificate, ckx *clientKeyExchangeMsg, version uint16) ([]byte, error) {544 // First, process the PSK identity.545 if len(ckx.ciphertext) < 2 {546 return nil, errClientKeyExchange547 }548 identityLen := (int(ckx.ciphertext[0]) << 8) | int(ckx.ciphertext[1])549 if 2+identityLen > len(ckx.ciphertext) {550 return nil, errClientKeyExchange551 }552 identity := string(ckx.ciphertext[2 : 2+identityLen])553 if identity != config.PreSharedKeyIdentity {554 return nil, errors.New("tls: unexpected identity")555 }556 if config.PreSharedKey == nil {557 return nil, errors.New("tls: pre-shared key not configured")558 }559 // Process the remainder of the ClientKeyExchange to compute the base560 // pre-master secret.561 newCkx := new(clientKeyExchangeMsg)562 newCkx.ciphertext = ckx.ciphertext[2+identityLen:]563 otherSecret, err := ka.base.processClientKeyExchange(config, cert, newCkx, version)564 if err != nil {565 return nil, err566 }567 if otherSecret == nil {568 // Special-case for the plain PSK key exchanges.569 otherSecret = make([]byte, len(config.PreSharedKey))570 }571 return makePSKPremaster(otherSecret, config.PreSharedKey), nil572}573func (ka *pskKeyAgreement) processServerKeyExchange(config *Config, clientHello *clientHelloMsg, serverHello *serverHelloMsg, cert *x509.Certificate, skx *serverKeyExchangeMsg) error {574 if len(skx.key) < 2 {575 return errServerKeyExchange576 }577 identityLen := (int(skx.key[0]) << 8) | int(skx.key[1])578 if 2+identityLen > len(skx.key) {579 return errServerKeyExchange580 }581 ka.identityHint = string(skx.key[2 : 2+identityLen])582 // Process the remainder of the ServerKeyExchange.583 newSkx := new(serverKeyExchangeMsg)584 newSkx.key = skx.key[2+identityLen:]585 return ka.base.processServerKeyExchange(config, clientHello, serverHello, cert, newSkx)586}587func (ka *pskKeyAgreement) generateClientKeyExchange(config *Config, clientHello *clientHelloMsg, cert *x509.Certificate) ([]byte, *clientKeyExchangeMsg, error) {588 // The server only sends an identity hint but, for purposes of589 // test code, the server always sends the hint and it is590 // required to match.591 if ka.identityHint != config.PreSharedKeyIdentity {592 return nil, nil, errors.New("tls: unexpected identity")593 }594 // Serialize the identity.595 bytes := make([]byte, 2+len(config.PreSharedKeyIdentity))596 bytes[0] = byte(len(config.PreSharedKeyIdentity) >> 8)597 bytes[1] = byte(len(config.PreSharedKeyIdentity))598 copy(bytes[2:], []byte(config.PreSharedKeyIdentity))...
Len
Using AI Code Generation
12: import (26: type config struct {38: }410: func (c config) Len() int {511: return len(c.name)612: }714: func main() {815: c := config{"Golang"}916: fmt.Println(c.Len())1017: }111: func (s string) Len() int {122: return len(s)133: }
Len
Using AI Code Generation
1func main() {2 fmt.Println(config.Len())3}4func main() {5 fmt.Println(config.Len())6}7func main() {8 fmt.Println(config.Len())9}10func main() {11 fmt.Println(config.Len())12}13func main() {14 fmt.Println(config.Len())15}16func main() {17 fmt.Println(config.Len())18}19func main() {20 fmt.Println(config.Len())21}22func main() {23 fmt.Println(config.Len())24}25func main() {26 fmt.Println(config.Len())27}28func main() {29 fmt.Println(config.Len())30}31func main() {32 fmt.Println(config.Len())33}34func main() {35 fmt.Println(config.Len())36}37func main() {38 fmt.Println(config.Len())39}
Len
Using AI Code Generation
1import "fmt"2func main() {3 c := config{1, 2, 3, 4, 5}4 fmt.Println(c.Len())5}6import "fmt"7func main() {8 c := config{1, 2, 3, 4, 5}9 fmt.Println(c.Len())10}11import "fmt"12func main() {13 c := config{1, 2, 3, 4, 5}14 fmt.Println(c.Len())15}16import "fmt"17func main() {18 c := config{1, 2, 3, 4, 5}19 fmt.Println(c.Len())20}21import "fmt"22func main() {23 c := config{1, 2, 3, 4, 5}24 fmt.Println(c.Len())25}26import "fmt"27func main() {28 c := config{1, 2, 3, 4, 5}29 fmt.Println(c.Len())30}31import "fmt"32func main() {33 c := config{1, 2, 3, 4, 5}34 fmt.Println(c.Len())35}36import "fmt"37func main() {38 c := config{1, 2, 3, 4, 5}39 fmt.Println(c.Len())40}41import "fmt"42func main() {43 c := config{1, 2, 3, 4, 5}44 fmt.Println(c.Len())45}46import "fmt"47func main() {
Len
Using AI Code Generation
1func main() {2 c.Len()3}4func (c *config) Len() int {5}6func main() {7 c.Len()8}9func (c *config) Len() int {10}11func main() {12 c.Len()13}14func (c *config) Len() int {15}16func main() {17 c.Len()18}19func (c *config) Len() int {20}21func main() {22 c.Len()23}24func (c *config) Len() int {25}26func main() {27 c.Len()28}29func (c *config) Len() int {30}31func main() {32 c.Len()33}34func (c *config) Len() int {35}36func main() {37 c.Len()38}39func (c *config) Len() int {40}
Len
Using AI Code Generation
1func main() {2 var config = new(Config)3 config.Len()4}5func main() {6 var config = new(Config)7 config.Len()8}
Len
Using AI Code Generation
1import "fmt"2func main() {3 config = Config{1, "abc"}4 fmt.Println(config.Len())5}6import "fmt"7func main() {8 config := Config{1, "abc"}9 fmt.Println(config.Len())10}11import "fmt"12func main() {13 config := Config{1, "abc"}14 fmt.Println(config.Len())15}16import "fmt"17func main() {18 config := Config{1, "abc"}19 fmt.Println(config.Len())20}21import "fmt"22func main() {23 config := Config{1, "abc"}24 fmt.Println(config.Len())25}26import "fmt"27func main() {28 config := Config{1, "abc"}29 fmt.Println(config.Len())30}31import "fmt"32func main() {33 config := Config{1, "abc"}34 fmt.Println(config.Len())35}36import "fmt"37func main() {38 config := Config{1, "abc"}39 fmt.Println(config.Len())40}41import "fmt"42func main() {43 config := Config{1, "abc"}44 fmt.Println(config.Len())45}46import "fmt"47func main() {48 config := Config{1, "abc"}49 fmt.Println(config.Len())50}51import "fmt"52func main() {53 config := Config{1, "abc"}54 fmt.Println(config.Len())55}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!